Notes
Secret managers
The baseline every team should reach is a secret manager. Instead of secrets in code or config files, they live in a central store, Vault or the cloud providers' secret managers, with access control, auditing and versioning. Applications fetch what they need at runtime, so no secret is committed. This alone gives central rotation, revocation and a full audit log. It is the foundation, but it still stores long-lived secrets, and the next steps reduce even that.
- a secret manager stores secrets centrally with access control and audit
- apps fetch at runtime; secrets never sit in code or config
- tools: HashiCorp Vault, AWS Secrets Manager, Azure Key Vault, GCP Secret Manager
- central rotation, central revocation, full audit log
Dynamic secrets
The first big step up is dynamic secrets. Rather than one shared, static database password every instance uses forever, a tool like Vault creates a unique database user on demand per application instance, valid for an hour, and revokes it when that lease ends. There is nothing to rotate, because the credential never lives long enough to matter, and a leaked one expires by itself within the hour. The same pattern works for cloud credentials and certificates. Dynamic secrets make rotation automatic.
- instead of one shared static DB password, Vault creates a unique DB user per app instance, valid for an hour
- it is auto-revoked when the lease ends
- no rotation needed: they never live long enough to matter
- a leak expires by itself
Workload identity
The best step of all is to store no secret. With workload identity, a workload proves who it is using the platform's identity, a cloud instance, a Kubernetes pod, a serverless function, and receives a short-lived token for exactly what it needs. Cloud roles for instances, pods and functions work this way: the machine's identity is the credential, so there is no key to store, leak or rotate. This is the modern default in cloud, and it removes the static access keys behind so many breaches.
- the workload proves WHO it is (its platform identity)
- and receives a short-lived token for what it needs
- cloud: IAM roles for instances, pods, functions (IRSA, workload identity)
- nothing is stored; nothing to leak or rotate
- the modern default in cloud
OIDC federation in CI
The same idea solves a classic weak spot: pipeline credentials. The old way stored a long-lived cloud access key as a CI secret, a huge target, because whoever steals it can act in your cloud account. With OIDC federation, the CI system, such as GitHub Actions, proves its identity to the cloud with a short-lived token, and the cloud hands back temporary credentials. No long-lived key is stored anywhere. This should be the default for any pipeline that touches a cloud account.
- old way: a long-lived cloud key stored as a CI secret (a huge target)
- OIDC federation: the CI system proves its identity with a short-lived token
- the cloud trusts that identity and issues temporary creds
- GitHub Actions, GitLab -> AWS, Azure, GCP; no stored key
Migrating
You do not get there overnight; migrate in stages. First, get secrets out of code into a secret manager, the highest-value move. Second, rotate the long-lived secrets you have and automate it. Third, replace static cloud access keys with workload identity. Fourth, adopt OIDC federation in your pipelines so no cloud key is stored in CI. Fifth, move databases and services to dynamic secrets. Each stage meaningfully cuts risk, so there is value even partway.
- get secrets out of code into a secret manager
- rotate the long-lived ones, automate it
- replace static cloud keys with workload identity
- adopt OIDC federation in CI
- dynamic secrets for databases and more each stage cuts risk
Why this wins
Why is this the direction everything is moving? Because short lifetimes change the game. A leaked credential expires on its own, quickly, so a leak is no longer a crisis. Rotation becomes automatic rather than a quarterly chore. You have far fewer long-lived secrets to guard. And every access is tied to an identity and audited. The ideal is that nothing static lives long enough to be worth stealing, which makes most of the secret incidents from the last two episodes stop happening.
- a leaked secret expires on its own, fast
- rotation becomes automatic, not a quarterly chore
- far fewer long-lived secrets to inventory and guard
- every access is identity-based and audited
- the ideal: nothing static long enough to be worth stealing
Common mistakes
Mistakes. Storing long-lived cloud keys in CI when OIDC federation would remove them entirely. Treating a secret manager as a dumping ground for static secrets that are never rotated, which is better than code but not the goal. Using static access keys where workload identity would work. Having no automated rotation. Setting very long token lifetimes, which throws away the main benefit of short-lived credentials. And printing secrets into logs, undoing all the careful storage in one line.
- long-lived cloud keys in CI instead of OIDC federation
- a secret manager used as a dumping ground, never rotated
- static keys where workload identity would work
- no automated rotation
- very long token lifetimes, losing the benefit
- secrets printed in logs
Say it like this
In the interview: the baseline is a secret manager with secrets fetched at runtime, never hard-coded, giving central rotation, revocation and audit. But I push toward short-lived credentials. I use workload identity so cloud workloads have no stored key, OIDC federation so pipelines reach the cloud without a long-lived key, and dynamic secrets so databases hand out per-use credentials that expire in an hour. The goal is that nothing static lives long enough to be worth stealing.
- "Secrets in a manager, fetched
- at runtime, never in code.
- Then push toward short-lived: workload identity so there is no stored key, OIDC federation
- for CI to cloud, and dynamic
- secrets for databases. A leaked short-lived credential
- expires on its own, so rotation is automatic."