Plan Secrets Management
Purpose
Ensure every credential, key and certificate has an owner, lives in a controlled store, reaches workloads without exposure, is rotated on a schedule and can be revoked quickly after a leak.
When to use
- Secrets are found in repositories, images, config files or plaintext pipeline variables.
- A leak or suspected exposure requires a structured remediation.
- A new platform or cluster needs a secret-handling design.
- An audit asks for rotation and access evidence.
When not to use
- Designing end-user authentication or authorization. Use
authn-authz-design.
- Reviewing a specific IaC change for secret leakage. Use
iac-review.
- Handling an active breach. Use
security-incident-response first.
Inputs
Required:
- Types of secrets in use and where they currently live (at least a rough list).
- Runtime and delivery platforms (VMs, containers, serverless, CI system category).
Optional, improves quality:
- Existing secret store or key management service, identity provider, compliance requirements (PCI DSS, ISO/IEC 27001 controls, KVKK/GDPR).
- Team structure and on-call model.
Never ask for or repeat actual secret values. If the user pastes one, tell them to treat it as compromised and rotate it.
Process
- Inventory secrets: type (database credential, API key, signing key, TLS certificate, token), consumer, owner, current location, last rotation, blast radius if leaked.
- Classify criticality (Critical/High/Medium) by blast radius and exposure.
- Prefer eliminating secrets: workload identity / managed identity, federated short-lived tokens for pipelines, IAM database authentication where supported.
- Define the central store requirements: encryption with keys in a KMS/HSM, fine-grained access policies, audit logging, versioning, dynamic secrets support, high availability. Stay product-neutral unless the user has one.
- Define access model: per-application identity, per-environment separation, least privilege, no human read access to production secrets by default, just-in-time elevated access.
- Define injection: runtime fetch or mounted volume/CSI-style driver, never baked into images or committed; how local development gets non-production secrets.
- Define rotation: frequency per class, automated where possible, dual-secret overlap to avoid downtime, certificate expiry monitoring.
- Define leak response: detection (secret scanning in repositories and pipelines, pre-commit hooks), revoke-rotate-verify runbook, history cleanup is secondary to rotation.
- Define audit and alerting: access logs retained, alerts on unusual access, periodic access review.
- Define break-glass: sealed emergency access, who, how logged, post-use rotation.
- Produce a phased migration plan from current state.
- Label every inference
[ASSUMPTION] and move unsupported items to open questions. If the goal continues, suggest iac-review to verify the implementation in code, authn-authz-design for workload identity, or pipeline-design for CI/CD credential flow.
Output format
# Secrets Management Plan: <system/org unit>
## Secret Inventory
| Secret | Type | Consumer | Owner | Current location | Criticality | Target mechanism | Rotation |
## Target Architecture (store, identity, injection)
## Access Model
## Rotation Policy
| Class | Frequency | Automated? | Overlap strategy |
## Detection and Leak Response
## Audit and Break-Glass
## Migration Phases
| Phase | Scope | Exit criteria |
## Open Questions / Assumptions
Quality checklist
Common pitfalls
- Moving secrets into a vault but giving every service read access to everything. Scope by identity and environment.
- Scrubbing git history and considering the leak resolved. The secret must be revoked and rotated.
- Rotation without consumer readiness, causing outages. Support two valid versions during rollover.
Example
Input: "SQL passwords and a payment API key in appsettings.json, pipeline has a cloud admin key as a variable."
Excerpt of output:
| Secret |
Criticality |
Target mechanism |
Rotation |
| Pipeline cloud admin key |
Critical |
Replace with federated short-lived identity, scoped per environment |
Eliminated |
| Payment API key |
Critical |
Central store, fetched at runtime by app identity |
90 days [confirm with provider] |
| SQL password |
High |
Managed identity auth if supported, else dynamic credentials |
Per lease |
1---2name: secrets-management-plan3description: "Produces a secrets management plan: inventory and classification of secrets, central store choice criteria, identity-based access with least privilege, injection into workloads and pipelines, rotation and revocation, audit, and break-glass. Use when a team stores secrets in code, config files or pipeline variables, after a leak, or when designing secret handling for a new platform."4license: MIT5metadata:6 source: https://skillmd.com/skills/muratdincer/secrets-management-plan7 version: "1.0.0"8 language: en9 category: 07-devops-sre10 role: devops-engineer11 area: infrastructure12 title: "Plan secrets management"13 related: "iac-review, pipeline-design, authn-authz-design, security-requirements, kubernetes-manifest-review"14 prompt: "Our database passwords and API keys are in appsettings files and pipeline variables. Write a plan to move to proper secrets management."15---1617# Plan Secrets Management1819## Purpose20Ensure every credential, key and certificate has an owner, lives in a controlled store, reaches workloads without exposure, is rotated on a schedule and can be revoked quickly after a leak.2122## When to use23- Secrets are found in repositories, images, config files or plaintext pipeline variables.24- A leak or suspected exposure requires a structured remediation.25- A new platform or cluster needs a secret-handling design.26- An audit asks for rotation and access evidence.2728## When not to use29- Designing end-user authentication or authorization. Use `authn-authz-design`.30- Reviewing a specific IaC change for secret leakage. Use `iac-review`.31- Handling an active breach. Use `security-incident-response` first.3233## Inputs34Required:35- Types of secrets in use and where they currently live (at least a rough list).36- Runtime and delivery platforms (VMs, containers, serverless, CI system category).3738Optional, improves quality:39- Existing secret store or key management service, identity provider, compliance requirements (PCI DSS, ISO/IEC 27001 controls, KVKK/GDPR).40- Team structure and on-call model.4142Never ask for or repeat actual secret values. If the user pastes one, tell them to treat it as compromised and rotate it.4344## Process451. Inventory secrets: type (database credential, API key, signing key, TLS certificate, token), consumer, owner, current location, last rotation, blast radius if leaked.462. Classify criticality (Critical/High/Medium) by blast radius and exposure.473. Prefer eliminating secrets: workload identity / managed identity, federated short-lived tokens for pipelines, IAM database authentication where supported.484. Define the central store requirements: encryption with keys in a KMS/HSM, fine-grained access policies, audit logging, versioning, dynamic secrets support, high availability. Stay product-neutral unless the user has one.495. Define access model: per-application identity, per-environment separation, least privilege, no human read access to production secrets by default, just-in-time elevated access.506. Define injection: runtime fetch or mounted volume/CSI-style driver, never baked into images or committed; how local development gets non-production secrets.517. Define rotation: frequency per class, automated where possible, dual-secret overlap to avoid downtime, certificate expiry monitoring.528. Define leak response: detection (secret scanning in repositories and pipelines, pre-commit hooks), revoke-rotate-verify runbook, history cleanup is secondary to rotation.539. Define audit and alerting: access logs retained, alerts on unusual access, periodic access review.5410. Define break-glass: sealed emergency access, who, how logged, post-use rotation.5511. Produce a phased migration plan from current state.5612. Label every inference `[ASSUMPTION]` and move unsupported items to open questions. If the goal continues, suggest `iac-review` to verify the implementation in code, `authn-authz-design` for workload identity, or `pipeline-design` for CI/CD credential flow.5758## Output format59```markdown60# Secrets Management Plan: <system/org unit>61## Secret Inventory62| Secret | Type | Consumer | Owner | Current location | Criticality | Target mechanism | Rotation |63## Target Architecture (store, identity, injection)64## Access Model65## Rotation Policy66| Class | Frequency | Automated? | Overlap strategy |67## Detection and Leak Response68## Audit and Break-Glass69## Migration Phases70| Phase | Scope | Exit criteria |71## Open Questions / Assumptions72```7374## Quality checklist75- [ ] No secret value appears anywhere in the output.76- [ ] Each secret has an owner and a rotation rule.77- [ ] Secret elimination via workload identity was considered before storing.78- [ ] Rotation strategy avoids downtime (overlap or versioning).79- [ ] Leak response says to rotate first, not only to delete from history.80- [ ] All checks pass; if any fails, revise the output and re-run this checklist before answering.8182## Common pitfalls83- Moving secrets into a vault but giving every service read access to everything. Scope by identity and environment.84- Scrubbing git history and considering the leak resolved. The secret must be revoked and rotated.85- Rotation without consumer readiness, causing outages. Support two valid versions during rollover.8687## Example88Input: "SQL passwords and a payment API key in appsettings.json, pipeline has a cloud admin key as a variable."8990Excerpt of output:91| Secret | Criticality | Target mechanism | Rotation |92|---|---|---|---|93| Pipeline cloud admin key | Critical | Replace with federated short-lived identity, scoped per environment | Eliminated |94| Payment API key | Critical | Central store, fetched at runtime by app identity | 90 days `[confirm with provider]` |95| SQL password | High | Managed identity auth if supported, else dynamic credentials | Per lease |