# Secrets Management

The controlled lifecycle for creating, storing, distributing, using, rotating, auditing, and revoking credentials and cryptographic keys.

- Type: practice
- Domain: Engineering & architecture
- Level: Intermediate
- Last reviewed: 2026-09-23
- Original: [Soroush’s Product Wiki](<https://wiki.soroush.uk/topic/secrets-management/>)

## What it means

Secrets management governs sensitive values that grant access or cryptographic capability, such as passwords, API keys, private keys, and database credentials. It combines protected storage with identity-based delivery, least privilege, short lifetimes, rotation, audit, and incident response.

## Why it matters

Secrets copied into code, configuration, images, tickets, or logs spread silently and remain usable after exposure. Central lifecycle controls reduce distribution, make ownership visible, and allow rotation or revocation without rebuilding every system manually.

## When to use it

Manage every non-public credential and key through an approved lifecycle, including development and automation. Prefer short-lived dynamically issued credentials when platforms support them, while retaining protected break-glass procedures for critical recovery.

## How it works

1. Inventory secrets, owners, consumers, privileges, environments, and rotation requirements.
2. Generate secrets securely and store them in a dedicated protected system.
3. Authenticate workloads or people before delivering only the secrets they need.
4. Keep secrets out of source control, command output, logs, images, and unnecessary environment exposure.
5. Rotate automatically with overlap and revoke quickly after compromise or ownership change.
6. Audit access, detect leakage, test recovery, and remove unused secrets.

## A practical example

A deployment workload authenticates with platform identity and retrieves a short-lived database credential at runtime. The value never enters the repository or container image, and audit logs connect issuance to one workload.

## Where it breaks

A secret manager becomes critical infrastructure and does not protect a secret after an authorized compromised process receives it. Migration, bootstrapping, availability, caching, and emergency access require careful design.

## Common mistakes

- Committing secrets and assuming removal from the latest revision erases history.
- Using one long-lived credential across people, services, and environments.
- Logging secrets through debug output, URLs, or failed command traces.
- Rotating a value without coordinating every consumer and fallback path.

## Visualization

[View the visualization on the website](<https://wiki.soroush.uk/topic/secrets-management/#visualization-secrets-management>)

## Sources

1. [Secrets Management Cheat Sheet](<https://cheatsheetseries.owasp.org/cheatsheets/Secrets_Management_Cheat_Sheet.html>) — OWASP Foundation · Security practice guidance
2. [Secrets](<https://kubernetes.io/docs/concepts/configuration/secret/>) — Kubernetes Documentation · Official technical documentation

## Related topics

- [API Key](<https://wiki.soroush.uk/topic/api-key/>)
- [Encryption](<https://wiki.soroush.uk/topic/encryption/>)
- [Authentication](<https://wiki.soroush.uk/topic/authentication/>)
