Steven's Knowledge

Secret Management

Centralized secret storage and rotation with HashiCorp Vault - static, dynamic, and short-lived credentials

Secret Management

Every system has secrets — database passwords, API tokens, TLS keys, signing keys, third-party credentials. A secret manager is the dedicated, audited, access-controlled store for them. Without one you end up with secrets in .env files, S3 buckets, Slack DMs, and git log — all very bad.

This section focuses on HashiCorp Vault, the de-facto open-source choice, with notes on cloud-native alternatives.

Why a Dedicated Secret Manager

WithoutWith Vault (or similar)
Secrets in env files, env vars, codeCentral store; apps fetch at runtime
Manual rotation, often skippedProgrammatic rotation; dynamic short-lived creds
No audit trail of who read whatEvery read logged with identity and timestamp
Static long-lived creds in CIWorkload identity → short-lived token from Vault
One leak compromises everythingPer-app least-privilege paths; revoke individually

Static vs Dynamic Secrets

The biggest mental shift from "store passwords in a vault."

ModeWhat you storeLifetimeExample
StaticThe secret itselfLongA pre-existing DB password you uploaded
DynamicCredentials to create secrets on demandSeconds to hours"Give me a Postgres user that exists for 1 hour"
LeasedEither, but with a TTL and renewalConfigurableAll Vault secrets carry leases

Dynamic secrets are Vault's killer feature. Your app asks Vault for a database connection, Vault asks the database to create a user with CREATE ROLE ... VALID UNTIL 'now+1h', hands the credentials back, and revokes them when the lease expires. The app never sees a permanent password, and a leak is bounded.

The Players

SystemNotes
HashiCorp VaultOpen-source + enterprise; the broad-spectrum standard
AWS Secrets ManagerNative to AWS; auto-rotation Lambdas; pay-per-secret
AWS SSM Parameter StoreSimpler/cheaper than Secrets Manager; static secrets only
GCP Secret ManagerGCP equivalent
Azure Key VaultAzure equivalent
Doppler / 1Password SecretsSaaS-first, dev-friendly UX
Infisical / Bitwarden SecretsOpen-source SaaS alternatives
SOPSFile-based encryption (not a service); good for GitOps
Sealed SecretsEncrypts Kubernetes Secrets for git-storable form

Vault wins for: dynamic secrets, multi-cloud, multi-tenant, advanced auth methods, transit encryption, PKI engine.

Learning Path

What a Secret Manager Doesn't Do

A common pattern: teams adopt Vault, then keep doing the same things slightly differently. Avoid these:

Anti-patternWhy it's bad
Storing secrets in env files and VaultTwo sources of truth; the env file will drift and leak
Long-lived VAULT_TOKEN env vars in productionThe token itself becomes the new long-lived secret
Treating Vault as a config storeConfigs aren't secrets; they belong in code / ConfigMaps
Manual rotation on a quarterly cadenceIf you can rotate, you can rotate weekly; if you can't rotate, why bother?
One root token shared by a teamThe whole point is per-app identity and audit

Vault unlocks dynamic, short-lived, audited credentials. The point isn't where secrets live; it's that they shouldn't live for long.

Secret management overlaps with Service Mesh (mTLS identity) and Kubernetes (workload identity, ServiceAccount tokens). The integration is the interesting part — see Best Practices for how they fit together.

On this page