Prompt
I'm building a platform team workflow for secrets across dev, staging, prod
Latest observation
A good platform-team workflow for secrets across dev, staging, and prod usually needs to solve four things:
- Where secrets live
- How they’re accessed
- How they’re rotated
- How they’re audited and promoted across environments
Here’s a practical blueprint.
Recommended operating model
1) Separate secrets by environment
Use a strict separation model:
- dev: lower-risk secrets, ephemeral where possible
- staging: production-like secrets, but isolated from prod
- prod: tightly controlled, least access
Do not share the same secret value across environments unless there is a strong reason. If a secret leaks in dev, you don’t want prod affected.
2) Use a centralized secret manager
A platform team should own a central secrets system such as:
- HashiCorp Vault
- AWS Secrets Manager / SSM Parameter Store
- Azure Key Vault
- GCP Secret Manager
- or a combination with Kubernetes External Secrets / CSI driver
Core principles
- Applications do not store secrets in code or container images.
- Humans should rarely read secrets directly.
- Workloads should fetch secrets at runtime using identity-based access.
3) Prefer dynamic secrets where possible
For databases, cloud services, and tokens, prefer dynamic, short-lived credentials:
Examples:
- Vault generates DB users on demand
- Cloud IAM roles instead of static access keys
- OIDC federation for CI/CD instead of long-lived tokens
Benefits:
- Easier rotation
- Smaller blast radius
- Better auditability
4) Define an environment access pattern
For workloads
Each app/environment gets its own identity, such as:
- Kubernetes service account
- cloud IAM role
- workload identity
- CI identity
That identity gets access only to:
- its own environment
- its own service secrets
- only the minimum permissions required
Example access structure
app1-devcan readapp1/dev/*app1-stagingcan readapp1/staging/*app1-prodcan readapp1/prod/*
5) Promote configuration, not secret values
A common mistake is copying secrets between environments. Better pattern:
- Keep secret definitions and paths consistent
- Promote the deployment config
- Generate or provision environment-specific secret values
Example:
DB_HOSTmay differ by envDB_PASSWORDshould be unique per envAPI_KEYshould typically be unique per env
6) Use GitOps or declarative secret references
Do not commit raw secrets to Git.
Instead, commit:
- secret references
- secret templates
- access policies
- rotation config
Example patterns:
- External Secrets Operator in Kubernetes
- Sealed Secrets
- SOPS-encrypted files
- Terraform-managed secret metadata
7) Rotation workflow
Have an explicit rotation process for each secret class.
Rotation categories
- Routine rotation: scheduled, e.g. every 30/60/90 days
- Emergency rotation: after suspected leak
- Lifecycle rotation: during app migration, ownership change, or vendor change
Good rotation practice
- Rotate dev first
- Validate in staging
- Then rotate prod in a controlled window
- For critical services, support dual-secret overlap during rotation
Example:
- Create new secret version
- Update app or deployment to accept both old and new
- Deploy and validate
- Remove old secret after confirmation
8) Access controls and approvals
Use a tiered access model:
Dev
- Developers may have limited access to dev secrets
- Read access can be broader but still scoped
Staging
- More restrictive
- Usually platform + service owners only
Prod
- Strongest controls
- Break-glass access only
- Approval and audit required
Recommended controls:
- RBAC/ABAC
- Just-in-time access
- Time-bound access grants
- Approval workflow for prod reads
- MFA for humans
9) Auditing and alerting
Track:
- who accessed what secret
- when it was accessed
- from where
- by which workload
- rotation history
- failed access attempts
Set alerts for:
- unusual access patterns
- secret reads outside deployment windows
- access from unexpected identities
- repeated denied access
10) Break-glass process
For production emergencies:
- Separate emergency role
- Strong approval or incident linkage
- Short TTL access
- Full audit logging
- Post-incident review
Do not use break-glass as a normal access path.
Suggested workflow by environment
Dev
Goal: speed and low friction
- Use short-lived or low-impact secrets
- Allow self-service with guardrails
- Use sandbox data and test credentials
- Rotate less critical secrets more frequently if automated
- Encourage local dev with
.envfiles generated from secure tooling, not hand-written production values
Staging
Goal: realism without production risk
- Use production-like topology
- Separate secret namespace/account/project
- Mirror production access patterns
- Use staging-only credentials for external services where possible
- Validate rotation and deployment workflows here first
Prod
Goal: strict security and reliability
- Minimal human access
- Workloads use identity-based retrieval
- No static secrets unless unavoidable
- Mandatory auditing
- Change management for sensitive secrets
- Rotation with rollback plans
A practical reference architecture
Option A: Vault-centric
- Vault is source of truth for secrets
- Kubernetes workloads authenticate via service account JWT / OIDC
- External Secrets Operator syncs secrets into Kubernetes
- Vault issues dynamic DB creds and cloud creds
Best for:
- multi-cloud
- strong secret lifecycle management
- dynamic secrets
Option B: Cloud-native secret manager
- AWS Secrets Manager / Azure Key Vault / GCP Secret Manager
- Use IAM/workload identity for access
- GitOps manages references and IAM policies
- CSI driver or external secrets fetch at runtime
Best for:
- teams already standardized on one cloud
- lower operational overhead
Policy recommendations
Naming convention
Use a consistent path scheme, such as:
org/app/env/secret-nameplatform/payments/prod/db-password
Ownership
Every secret should have:
- owner/team
- environment
- purpose
- rotation policy
- expiration date if applicable
Classification
Tag secrets as:
- critical
- standard
- ephemeral
- third-party
- machine-to-machine
- human access only if unavoidable
Minimal platform-team operating process
- App team requests a secret or integration
- Platform team determines:
- static vs dynamic
- env scope
- access policy
- Platform team provisions secret path and IAM/RBAC
- App consumes secret via runtime identity
- Rotation policy is configured
- Auditing and alerts are enabled
- Secret is reviewed periodically
Common anti-patterns to avoid
- Committing secrets to Git
- Sharing prod secrets with dev/staging
- Using the same password across environments
- Long-lived cloud access keys for apps
- Giving developers direct prod secret read access by default
- Manual copying/pasting of secret values
- No rotation ownership
- No audit trail
- Storing secrets in CI variables without scoping/rotation
If you want a simple starting standard
A strong baseline policy is:
- One secret namespace per app per environment
- No shared secret values across environments
- Workload identity only, no static credentials unless unavoidable
- Dynamic secrets for databases and cloud services
- Git stores references, never secret values
- Dev self-service, staging controlled, prod restricted
- Rotation automated and tested in staging first
- Full audit logging and alerts
- Break-glass only for prod emergencies
If you want, I can turn this into one of these formats:
- a concrete policy document
- a workflow diagram
- a Kubernetes + External Secrets implementation pattern
- a Terraform/IaC example
- an opinionated runbook for app teams