Contents
- The Problem: Secrets Sprawl
- Static Secrets vs. Dynamic Secrets
- The Platforms: Vault, Cloud-Native Vaults, and the Rest
- How Apps Authenticate Without a Bootstrap Secret
- Rotation: Why It's Hard and How to Make It Routine
- A Worked Example: An App Pulling a Database Credential
- Secrets in CI/CD
- When Full Vault Is Overkill
The Problem: Secrets Sprawl
Secrets sprawl is rarely one bad decision — it's dozens of small, individually reasonable ones that accumulate into a real exposure:
- Hardcoded in source. A credential committed to a repository is a credential in git history forever, even after the file is edited or deleted — git does not forget, and a rotation is the only real remediation once it's happened.
- Environment variables set by hand. Better than hardcoding, but with no access control (anyone who can read the process environment reads the secret), no audit trail of who set or read it, and no rotation mechanism beyond someone remembering.
- Shared out of band. A password in a chat message, an email, a spreadsheet — convenient, unauditable, and durable in exactly the places you don't want a credential to persist.
The common thread is that each of these is a secret with no lifecycle: nobody owns rotating it, nobody has a record of who has it, and nobody finds out it leaked until it's used against them. A secrets platform doesn't make credentials disappear — applications still need to authenticate to something — but it gives every credential an owner, an access policy, an audit log, and a rotation path, which is the difference between a leak being detectable and a leak being permanent.
Static Secrets vs. Dynamic Secrets
The distinction that separates a real secrets platform from a well-organized password store:
- Static secrets. A credential generated once and stored — an API key from a third-party service, a signing certificate. The platform's job is access control, versioning, and rotation reminders, but the credential itself doesn't change unless something rotates it manually or on a schedule.
- Dynamic secrets. The platform generates a credential on demand, scoped to a short lease, and revokes it automatically when the lease expires. A database credential that exists for one hour and is unique per requester is a dynamic secret — nobody has to remember to rotate it, because it was never meant to outlive the lease.
Dynamic secrets are the more powerful pattern where the backend supports them (databases, cloud IAM, PKI) because they eliminate the rotation problem entirely — a credential that expires on its own doesn't need a rotation process, it needs nothing. Static secrets remain necessary for anything the platform can't generate on demand (most third-party SaaS API keys), which is why a real secrets program uses both, not one or the other.
The Platforms: Vault, Cloud-Native Vaults, and the Rest
| Platform | Model | Best fit |
|---|---|---|
| HashiCorp Vault[1] | Self-hosted or managed (HCP Vault); the broadest secret-engine ecosystem — dynamic database credentials, PKI issuance, cloud IAM, transit encryption | Multi-cloud or hybrid estates that want one platform and are willing to operate (or pay for a managed) Vault cluster |
| AWS Secrets Manager[2] | Managed, AWS-native; automatic rotation for supported RDS/database types via built-in Lambda rotation functions | AWS-centric estates that want the lowest-friction native option and don't need cross-cloud secret engines |
| Azure Key Vault[3] | Managed, Azure-native; also holds certificates and keys (HSM-backed tiers available), tightly integrated with managed identities | Azure-centric estates, especially where managed identity auth (see below) removes the bootstrap problem almost entirely |
| Google Secret Manager[4] | Managed, GCP-native; simpler feature set than Vault, versioned secrets with IAM-based access | GCP-centric estates with straightforward static-secret needs |
| CyberArk Conjur[5] | Enterprise secrets management tied into a broader PAM platform | Estates that already run CyberArk for privileged access and want secrets management under the same governance |
The decision usually reduces to scope: a single-cloud estate is well served by that cloud's native vault, with less to operate and tighter identity integration out of the box. A multi-cloud or hybrid estate — or one that specifically needs dynamic database credentials, PKI issuance, or Vault's transit encryption-as-a-service — is where Vault's broader engine ecosystem earns the extra operational surface.
How Apps Authenticate Without a Bootstrap Secret
The obvious question undermines the whole point if answered wrong: if an application needs a secret from the vault, how does it authenticate to the vault itself — without that authentication becoming a new stored secret, right back where the problem started? The answer is identity-based authentication, where the platform verifies something the application already is, not something it has to remember:
- Cloud IAM auth. An application running on a cloud VM or in a managed service authenticates using the cloud provider's own identity mechanism — an AWS IAM role, an Azure managed identity, a GCP service account — which the platform verifies against the cloud provider directly. No credential is stored anywhere; the platform trusts the cloud's own attestation of "this is really that VM/service."
- Kubernetes auth. A pod authenticates using its Kubernetes service account token, which the vault verifies against the cluster's API server. The pod never holds a vault credential — its Kubernetes identity is the credential.
- AppRole (Vault-specific). The fallback for workloads that have no platform identity for Vault to verify. It splits the credential in two: a role ID, which only names the set of permissions being requested and isn't sensitive, and a secret ID, which is the actual secret and is delivered to the machine once at provisioning time over a channel you already trust. That closes most of the bootstrap gap but not all of it — there is still a secret in play, which is a weaker guarantee than the identity-based methods above, though it is short-lived and grants only that one role rather than access to the vault at large.
The pattern to design toward: the application's platform identity (its cloud role, its Kubernetes service account) is the credential, verified by a trust relationship configured once between the vault and the platform — not a secret the application has to be handed and protect. This is what actually breaks the "secret to get a secret" chain, and it's worth treating as a requirement, not a nice-to-have, for anything running on infrastructure that supports it.
Rotation: Why It's Hard and How to Make It Routine
Rotation is where secrets programs stall, and the reason is almost always coordination, not technology:
- Every consumer has to pick up the new value before the old one is revoked. Rotate a database password and revoke the old one immediately, and every application instance still holding a cached copy of the old credential breaks at once. The safe sequence is issue-new, wait for consumers to refresh (or push the update), then revoke-old — and that wait is exactly the coordination work manual rotation skips, which is why manual rotation degrades into "we'll rotate it during the next outage window" and then never happens.
- Dynamic secrets sidestep the problem by design. A credential that expires on a lease doesn't need a coordinated rotation — every consumer already expects to request a fresh one, so there's no "old" value anyone is depending on past its lease.
- Automated rotation for static secrets is the practical middle ground. Cloud-native vaults offer scheduled rotation for supported secret types (a managed database password, for example) via a built-in function that updates both the credential and the database in the same operation — closing the manual-coordination gap for the cases the platform explicitly supports.
Use dynamic secrets where the backend supports them, automate rotation for static secrets with supported integrations, and maintain a documented schedule and owner for the remaining static credentials.
A Worked Example: An App Pulling a Database Credential from Vault
The shape of an application authenticating via a Kubernetes service account and retrieving a dynamic, short-lived database credential — the pattern, not a copy-paste production config.
# One-time setup (an operator does this, not the app):
# enable the database secrets engine and define a role that
# maps to a narrowly-scoped SQL user with a short TTL.
vault secrets enable database
vault write database/config/app-db \
plugin_name=postgresql-database-plugin \
connection_url="postgresql://{{username}}:{{password}}@db.internal:5432/appdb" \
allowed_roles="app-readwrite"
vault write database/roles/app-readwrite \
db_name=app-db \
creation_statements="CREATE ROLE \"{{name}}\" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}'; GRANT SELECT, INSERT, UPDATE ON ALL TABLES IN SCHEMA public TO \"{{name}}\";" \
default_ttl="1h" \
max_ttl="4h"
# At runtime, the app authenticates via its Kubernetes service
# account token — no stored Vault credential anywhere.
import hvac
client = hvac.Client(url="https://vault.internal:8200")
client.auth.kubernetes.login(
role="app-readwrite-role",
jwt=open("/var/run/secrets/kubernetes.io/serviceaccount/token").read(),
)
# Request a fresh, unique, short-lived database credential
creds = client.secrets.database.generate_credentials(name="app-readwrite")
db_user, db_pass = creds["data"]["username"], creds["data"]["password"]
# Connect with these — Vault revokes them automatically at TTL expiry.
Notice what never appears anywhere in the application's configuration: a database password. The application authenticates with an identity it already has, receives a credential that's unique to that run and expires on its own, and the operator never has to coordinate a rotation across every instance — the lease does that for free.
Version drift is real here. Vault's CLI syntax, the supported database plugins, and the client libraries' APIs (hvac for Python, and the equivalents for other languages) evolve across releases, and cloud-native vaults have their own SDKs with different shapes entirely. Treat the commands above as the current pattern and confirm the exact syntax against the documentation for the version you're running before you build on it.
Secrets in CI/CD
CI/CD pipelines are a special case worth naming, because a pipeline holding cloud credentials is exactly the kind of high-value, high-blast-radius secret this whole discipline exists to protect — and the best answer here often isn't "store the secret better," it's "don't store it at all." OIDC federation — covered in the companion article on CI/CD pipelines — works by having the CI platform issue a signed statement about the job that is running (which repository, which branch, which workflow), and configuring the cloud to trust statements from that platform. The job trades that statement for a cloud role that lasts only as long as the job does, so there is no long-lived cloud credential sitting in a secret store to leak or rotate. Where OIDC doesn't cover the case — a third-party API token, a registry password — that's exactly the short list of secrets that belong in the vault, scoped to the specific pipeline stage that needs them and nothing else.
When Full Vault Is Overkill
Not every team needs a Vault cluster:
- A handful of secrets, a small team. A well-organized team password manager with sharing controls and an audit log, plus environment variables sourced from it at deploy time, covers a genuinely small footprint without the operational overhead of running (or paying for) a dedicated secrets platform.
- Already single-cloud with light needs. If every secret is a static API key or two and the estate lives entirely in one cloud, that cloud's native secrets service is usually enough — standing up Vault for what the native service already does is added operational surface without added capability.
- No dynamic-secret backend that matters yet. Vault's biggest advantage is dynamic secrets for databases, PKI, and cloud IAM. If none of those apply yet, you're paying the operational cost of the platform for the static-secret feature set alone, which every alternative on this page also provides.
Rule of Thumb: Adopt a dedicated secrets platform when you have credentials in more than one system that need coordinated rotation, or when a dynamic-secret backend — a database, a cloud IAM role, or a certificate authority (a PKI) that can mint a credential on request and let it expire on its own — would eliminate a rotation process you're currently doing by hand. Below that, the operational cost of running or licensing the platform is real, and a disciplined password manager plus environment variables is a legitimate stopping point — not a shortcut you'll regret.
References
- HashiCorp — "Vault Documentation": secret engines, auth methods, dynamic secrets, and the leasing/revocation model. HashiCorp Documentation, current.
- Amazon Web Services — "AWS Secrets Manager" documentation: secret storage, automatic rotation, and IAM-based access. AWS Documentation, current.
- Microsoft — "Azure Key Vault" documentation: secrets, keys, certificates, and managed identity integration. Microsoft Learn, current.
- Google Cloud — "Secret Manager" documentation: secret versioning and IAM-based access control. Google Cloud Documentation, current.
- CyberArk — "Conjur" documentation: secrets management for machine identities within the CyberArk platform. CyberArk Technical Documentation, current.