Rotate Keys and Secrets
Use this runbook on a rotation schedule, after suspected exposure, or when a person with secret access leaves. Rotate one class at a time. Inventory the KEK, zone signing keys, integrity HMACs, idempotency HMAC, Gateway-STS HMAC, service tokens, storage credentials, and web auth secret.
Prerequisites
Section titled “Prerequisites”Keep current data and secret backups, owners for every producer/consumer, canary requests, and a documented overlap window where supported.
Safe Procedure
Section titled “Safe Procedure”- Generate replacement material cryptographically.
- Use
SECRET_STORE_KEK_PREVIOUSfor envelope re-sealing andIDEMPOTENCY_HMAC_KEY_PREVIOUSfor receipt overlap. - Update every producer and consumer of a shared HMAC before retirement.
- Roll affected services and wait for readiness.
- Check audit, stream, replay, revocation, JWKS, and canary signals.
- Retire old material only after applicable token, cache, message, replay, or receipt windows.
Keep the old idempotency key for at least IDEMPOTENCY_RETENTION_SECONDS.
Verify
Section titled “Verify”Confirm retired credentials fail, envelopes decrypt, JWKS is expected, new stream/audit messages verify, pending entries drain, and Gateway-to-STS exchange succeeds.
Recovery
Section titled “Recovery”Restore the retiring value before deletion if verification fails. Preserve logs, DLQ, and replay state. Never regenerate a lost KEK; restore its backup.
Next Step
Section titled “Next Step”Verify PostgreSQL and Redis Streams.

