Rotate a Secret
Symptoms
A secret may be compromised, someone with access to it left, or the provider requires a new one.
Impact
The services that read the group restart (rolling). Some secrets have wider effects, listed in step 4.
Steps
- Create the new value at the provider (or
openssl rand -hex 32for our own keys). Keep the old one valid until step 5. - Northflank → the project → Secrets → the group (
api-secrets,realtime-shared,centrifugo-secrets,alloy-secrets) → edit the key → save. - Restart dependents from the group page, in the same sitting.
- Special cases:
- DB password: it is in two groups,
api-secrets(POSTGRES_URL) andcentrifugo-secrets(the outbox DSN). Change both before restarting. realtime-shared: each value is there under two names, one for the api and one for the broker; change both names of a pair. The third pair is not a plain copy:CENTRIFUGO_PROXY_SECRETholds the secret, andCENTRIFUGO_CHANNEL_PROXY_SUBSCRIBE_HTTP_STATIC_HEADERSholds{"X-Centrifugo-Proxy-Secret":"<the same secret>"}.TOKEN_ENCRYPTION_KEY: never paste a new value. Follow the key rotation procedure in the backend README.COOKIE_*keys: rotating them signs every user out.
- DB password: it is in two groups,
- Revoke the old value at the provider once the services run the new one.
Never put a value in a template file, a pull request, a chat or a ticket.
Verification
- The restarted services are healthy in Northflank and
/healthanswers. - The feature that uses the secret works (a sign-in for WorkOS, a call for LiveKit, an upload for R2).
Escalation
The team owner.