A database password, a payment gateway token, a signing key — all of these are secrets: a leak of any one of them gives an attacker access to the system. Secrets management gathers them out of code, configuration files and notes into a single store with access control, auditing and replacement rules.
What counts as a secret
| Type | Examples |
|---|---|
| Service credentials | a database connection string, an API key for an external service |
| Tokens and certificates | a JWT signing secret, a TLS certificate for an internal service |
| Cryptographic keys | a backup encryption key, an image signing key |
| Infrastructure access | an SSH private key, cloud provider credentials |
How a secrets store works
Secrets live in a dedicated store — for example HashiCorp Vault, AWS Secrets Manager or a cloud KMS. An application, a service or a CI job receives its secrets at runtime rather than at build time: it authenticates to the store and requests only what it is allowed to — the principle of least privilege. The store delivers the value over a secure channel and keeps a log of who read what and when.
Rotation and dynamic secrets
Long-lived secrets are replaced periodically — rotation limits the damage from a leak: the old value stops working. Stores can also issue dynamic secrets: temporary credentials that are created on demand and revoked automatically when their lifetime expires. For a database, for example, you can issue a login and password valid for an hour instead of a permanent password baked into the configuration. In Kubernetes, a common technique is a sidecar container: it authenticates to the store, writes a fresh secret to a shared volume and refreshes it periodically, without the main application knowing anything about it.
Where secrets must never end up in code
- in the repository — a value committed to Git stays there forever, even after it is removed from the history;
- in a container image layer — a layer can be downloaded from the registry and inspected without starting the container;
- in CI and application logs — a log is often visible to a wider audience than it seems;
- in a shared environment variables file that is copied between projects.
Instead, the secret is supplied at runtime — from the store or by injection into the process environment. Secret scanners look for keys that accidentally end up in a repository, but a secret found by a scanner is still considered compromised and replaced.
Sources
the term is written from these pagesVerified 9 Nov