{"id":37125831,"url":"https://github.com/grepplabs/spring-config-decryptor-webhook","last_synced_at":"2026-01-14T14:32:44.721Z","repository":{"id":133855514,"uuid":"302984486","full_name":"grepplabs/spring-config-decryptor-webhook","owner":"grepplabs","description":"Kubernetes mutating webhook decrypting configmaps and secrets encrypted with Spring Cloud Config asymmetric key","archived":false,"fork":false,"pushed_at":"2020-10-12T19:43:38.000Z","size":1636,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T18:01:44.474Z","etag":null,"topics":["decryption","kubernetes","mutatingadmissionwebhook","mutatingwebhookconfiguration","rsa","spring-cloud-config","webhook"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grepplabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-10T20:29:28.000Z","updated_at":"2020-10-12T19:43:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"569c6aa3-9c77-4d54-926c-f752c95d53c9","html_url":"https://github.com/grepplabs/spring-config-decryptor-webhook","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/grepplabs/spring-config-decryptor-webhook","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grepplabs%2Fspring-config-decryptor-webhook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grepplabs%2Fspring-config-decryptor-webhook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grepplabs%2Fspring-config-decryptor-webhook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grepplabs%2Fspring-config-decryptor-webhook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grepplabs","download_url":"https://codeload.github.com/grepplabs/spring-config-decryptor-webhook/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grepplabs%2Fspring-config-decryptor-webhook/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28423404,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T13:30:50.153Z","status":"ssl_error","status_checked_at":"2026-01-14T13:29:08.907Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["decryption","kubernetes","mutatingadmissionwebhook","mutatingwebhookconfiguration","rsa","spring-cloud-config","webhook"],"created_at":"2026-01-14T14:32:43.996Z","updated_at":"2026-01-14T14:32:44.690Z","avatar_url":"https://github.com/grepplabs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spring-config-decryptor-webhook\n\n| WARNING: DO NOT USE IN PRODUCTION |\n| --------------------------------- |\n\nKubernetes mutating webhook decrypting configmaps  and secrets encrypted with Spring Cloud Config asymmetric key.\n\n**Do not use in production as webhook http endpoint is unprotected and allows decryption of arbitrary secrets** \n\n## Usage example\n\nPrerequisites:\n\n- [cert-manager](https://github.com/jetstack/cert-manager)\n- The `spring` command line client (with [Spring Cloud CLI](https://cloud.spring.io/spring-cloud-cli/reference/html/) extensions installed)\n- [helm 3](https://github.com/helm/helm) version v3.3.4\n- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/)\n\n1.Generate RSA key pair\n\n```\n$ openssl genrsa -out rsa-private-key.pem 4096\n$ openssl rsa -in rsa-private-key.pem -outform PEM -pubout -out rsa-public-key.pem\n```\n\n2.Create kubernetes secret with RSA private key\n\n```\n$ kubectl create namespace webhook\n$ kubectl create secret generic spring-encrypt-key -n  webhook --from-file=rsa-private-key=rsa-private-key.pem\n```\n\n3.Deploy mutating webhook to kubernetes\n\nDepending on your kubernetes installation change helm values and invoke make accordingly.\n\n```\n$ make HELM_VALUES=values-eks.yaml KUBE_CONTEXT=test-cluster helm-install\n```\n\n4.Check the deployment\n\n```\n$ kubectl get all -n webhook\nNAME                                                   READY   STATUS    RESTARTS   AGE\npod/spring-config-decryptor-webhook-7c8bfc8d54-dw8dc   1/1     Running   0          5m50s\n\nNAME                                      TYPE           CLUSTER-IP      EXTERNAL-IP                                                                           PORT(S)         AGE\nservice/spring-config-decryptor-webhook   LoadBalancer   172.20.30.252   internal-a785e316153b849e7bbee4001035c7ba-1452171545.eu-central-1.elb.amazonaws.com   443:32458/TCP   5m50s\n\nNAME                                              READY   UP-TO-DATE   AVAILABLE   AGE\ndeployment.apps/spring-config-decryptor-webhook   1/1     1            1           5m50s\n\nNAME                                                         DESIRED   CURRENT   READY   AGE\nreplicaset.apps/spring-config-decryptor-webhook-7c8bfc8d54   1         1         1       5m50s\n\n```\n\n```\n$ kubectl get secrets -n webhook\nNAME                                                    TYPE                                  DATA   AGE\ndefault-token-vw4bg                                     kubernetes.io/service-account-token   3      3d2h\nsh.helm.release.v1.spring-config-decryptor-webhook.v1   helm.sh/release.v1                    1      6m42s\nspring-config-decryptor-webhook-certificate             kubernetes.io/tls                     3      6m42s\nspring-config-decryptor-webhook-token-wlshn             kubernetes.io/service-account-token   3      6m42s\nspring-encrypt-key                                      Opaque\n```\n\n5.Check `cert-manager` injected `caBundle` into `mutatingwebhookconfigurations`\n\n```\n$ kubectl get mutatingwebhookconfigurations.admissionregistration.k8s.io spring-config-decryptor-webhook -o json | jq -r '.webhooks[].clientConfig'\n{\n  \"caBundle\": \"LS0tLS1CRUdJTiBDRVJUSUZ....\",\n}\n{\n  \"caBundle\": \"LS0tLS1CRUdJTiBDRVJUSUZ....\",\n}\n```\n\n6.Create RSA encrypted `test-secret` secret with `spring-config-decrypt=true` label. Prefix the encrypted password value with`{cipher}`\n\n```\nENCRYPTED_PASSWORD=$(spring encrypt --key @./rsa-public-key.pem my-password)\nkubectl create secret generic test-secret --from-literal=\"username=my-app\" --from-literal=\"password={cipher}${ENCRYPTED_PASSWORD}\" -o yaml --dry-run | kubectl label -f- --dry-run -o yaml --local spring-config-decrypt=\"true\" | kubectl apply -n webhook -f -\n```\n\nCheck the mutating webhook decrypted the secret, and it is store in the plain text.\n\n```\n$ kubectl get secrets -n webhook test-secret -o json | jq -r '.data.password' | base64 -d\nmy-password\n```\n\n\n7.Create RSA encrypted `test-cm` configmap. Prefix secret property value with`{cipher}`\n\n```\nENCRYPTED_VALUE=$(spring encrypt --key @./rsa-public-key.pem value2)\nkubectl create configmap test-cm -n webhook --from-literal key1=value1 --from-literal \"key2={cipher}${ENCRYPTED_VALUE}\"\n```\n\nCheck `key2` is still encrypted\n\n```\n$ kubectl get configmaps -n webhook test-cm -o json | jq '.data'\n{\n  \"key1\": \"value1\",\n  \"key2\": \"{cipher}AgBBmob53tmsrm8ufAyVeSjLa3WDvRxa6OTLa5gDpG7wp5qoHZ90W78Fn117LOQ6QgrQ+N4TgoIZsS2dbNeYK+UrPr2hXgw+aHqUFxflifnA4KwfVNIHVQ2Z+XafJw2eaMh7ARUhxnWw2LPWM6M9LNCPJe9oExp/tW/6UOZLCfApVLVyEursRNMfGCeUDQB/2QfFKfgIExMbwkdPhUpjSokwgYjZy9fgNFNMY0Ovq4XNPISEwaNmKs5OskhMAdvfmUZnQ89ipDFK3pD+N//EHm0b6Bax2pNcIVMYe3296YQrvJ6Uh/bfdblVii6PLgyjAiEpxzYN4Q+sbq338C2IZoSZiAqLJzSWel5bwrzbUPKGJmiYRbIyhHVtuupw8L/oiRVxzx3iQcfXqvXE2k6gNNQ4JwqlUmrQq0eH5v9/GE/BMuIhLi13oTia1DGjSMxgzO/zdtG0By0c374fmH07O+Yxspg8rf4PDZWhprCrEvgXI7XTHjr8yk1rmZSZ/Cg4+E1Wp+yf89hSKQurjQC8ycIvljTF8ng5HaLl+Xzq3jber/Wzsu1zddunb06uzM3KeZgxvGFo3ZIuk+JZfskDCDa+MqCO81lIMe3oFT6u0ywciA3Vems5O36eitv5UOT569n6mY3pLwGQNVv+0M4QxR0XINM/WnJ8UPr2uzlAa6ckMlkwBxABTMK2C5bj8IAUUuEtPXLI/FLnDxywju7un7sV\"\n}\n```\n\n\nLabel the config map with `spring-config-decrypt=true` and check the decrypted secret\n\n```\n$ kubectl label configmap -n webhook test-cm spring-config-decrypt=true\n$ kubectl get configmaps -n webhook test-cm -o json | jq '.data'\n{\n  \"key1\": \"value1\",\n  \"key2\": \"value2\"\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrepplabs%2Fspring-config-decryptor-webhook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrepplabs%2Fspring-config-decryptor-webhook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrepplabs%2Fspring-config-decryptor-webhook/lists"}