Secret rotation & git-history purge (launch blocker B-10 / B-11)
Brouillon : cette page n'a pas encore été relue et peut être incomplète ou inexacte.
Two production secrets were committed and remain recoverable from git history in
both repos. Removing them from the working tree (this PR deletes values-do.yaml)
is not sufficient — anyone who has ever cloned, or who reads history, can still
read them. They must be rotated and the history purged. This is an
out-of-band operation (it rewrites history and touches live infrastructure); it
cannot be done by a normal merge.
What is exposed
Section intitulée « What is exposed »| Secret | Where | Repo/commits (ancestors of master) |
|---|---|---|
| Prod Postgres password | helm/kili-shops/values-do.yaml (removed in this PR) |
backend 9209998, 0c2846a |
| Kkiapay webhook secret | historical frontend .env |
frontend d2ac547, 14f7d2e, e33e38c |
| Frontend public keys (reCAPTCHA site key, FedaPay/Kkiapay public keys, Google client id, TinyMCE key) | historical frontend .env |
frontend (same commits) — public by nature; rotate only if policy requires |
SMTP creds (H-9) were never committed as real values (placeholders only) — no action.
Do these in order
Section intitulée « Do these in order »1. Rotate at the source (do this first — assume both are compromised)
Section intitulée « 1. Rotate at the source (do this first — assume both are compromised) »- Postgres: change the password on the managed DB / cluster, then update the
Kubernetes secret only (never a values file):
The chart already reads the password via
Fenêtre de terminal kubectl -n <ns> create secret generic postgresql-secret \--from-literal=postgres-password='<NEW_STRONG_PASSWORD>' \--dry-run=client -o yaml | kubectl apply -f -kubectl -n <ns> rollout restart deploy/users statefulset/postgres # pick up the new valuesecretKeyRef: postgresql-secret— no values file needs the plaintext. - Kkiapay webhook secret: regenerate it in the Kkiapay dashboard, then set the
new value as
KKIAPAY_WEBHOOK_SECRET(helm--set appSecrets.kkiapayWebhookSecret=…/ your secret manager). The users service already fails-closed if it’s unset.
2. Stop re-introducing the file
Section intitulée « 2. Stop re-introducing the file »helm/kili-shops/values-do.yamlis removed (this PR). The per-environment overlaysvalues-{dev,staging,prod}.yamlare the replacement; real secrets are injected via--set appSecrets.*/secretKeyRef, never committed.docs/DEPLOY-DIGITAL-OCEAN.mdanddocs/FIX-REGISTRY-AUTH.mdstill describe the oldvalues-do.yamlflow — followvalues-prod.yaml+--setsecrets instead.
3. Purge git history (coordinated — everyone re-clones afterward)
Section intitulée « 3. Purge git history (coordinated — everyone re-clones afterward) »Use git filter-repo (preferred) on a
fresh mirror clone of EACH repo. Freeze merges first.
# Backendgit clone --mirror git@github.com:af-corporation-outlook-com/kili-shops-microservices.gitcd kili-shops-microservices.gitgit filter-repo --path helm/kili-shops/values-do.yaml --invert-paths# and scrub any residual literal. Supply the real value from a LOCAL, untracked# file — never paste the plaintext secret into this (committed) doc:git filter-repo --replace-text <(echo '<OLD_POSTGRES_PASSWORD>==>REDACTED')git push --force --mirror
# Frontend (scrub the historical .env value)git clone --mirror git@github.com:af-corporation-outlook-com/kilimmanjaro.gitcd kilimmanjaro.gitgit filter-repo --path .env --invert-pathsgit filter-repo --replace-text <(echo '<kkiapay-webhook-secret-value>==>REDACTED')git push --force --mirrorAfter the force-push: everyone deletes their local clones and re-clones (old clones still contain the secrets). Rotate again if any secret could have been used between step 1 and now. Consider GitHub secret-scanning / push protection to prevent recurrence.
4. Verify
Section intitulée « 4. Verify »git log --all -S '<OLD_POSTGRES_PASSWORD>' --oneline # backend → no resultsgit log --all -S '<kkiapay-webhook-secret>' --oneline # frontend → no resultsWhy this is a launch blocker
Section intitulée « Why this is a launch blocker »Until rotation and purge are both done, the leaked credentials remain usable by anyone with the history. Removing the file (this PR) closes the working-tree exposure only.