Contract
- Input: secret types (API keys, database credentials, certificates, tokens), runtime environments (Kubernetes, VMs, serverless), compliance requirements.
- Output: secrets management architecture + rotation schedule + injection design + audit findings.
- Scope: designs and audits secrets management; does not rotate live production secrets without explicit approval.
- Rule: designs and audits secrets management; does not rotate live production secrets without explicit approval.
- Rule: documented standards override defaults; explicit project rules take precedence.
- Rule: if blocked by missing context or dependencies, surface the blocker before proceeding.
Provenance
| Question |
Answer |
| What is the source of truth? |
The user's request, originating spec/issue, and the skill's declared outputs |
| What is in scope? |
Work covered by the skill's acceptance criteria and completion rules |
| What is explicitly out of scope? |
Files, behaviors, and decisions outside the skill's declared boundary |
| Who or what consumes this artifact afterward? |
The next skill in the workflow or the user |
| What evidence proves it is done? |
Completion criteria met, artifact saved, validation passed |
| What risk remains? |
Subjective judgment calls, missing context, or external dependency failures |
Artifact
Emit SecretManagementSecurityArtifact as both:
- JSON:
.agents/skills/platform/artifacts/secret-management-security/{identifier}.json
- Markdown view: same filename with
.md extension
Secret Management Security
Design and audit secrets management — Vault, KMS, rotation, injection, and External Secrets Operator — with explicit lifecycle controls and leakage prevention.
Process
1. Secrets inventory and classification
- Enumerate all secrets: API keys, database credentials, TLS certificates, OAuth tokens, service account keys, signing keys.
- Classify by sensitivity: low (public API key with rate limit), medium (internal service key), high (database root, signing key).
- Map secret owners, rotation schedules, and storage locations.
Completion criterion: secrets inventory and classification saved.
2. Secrets management architecture
- Vault (HashiCorp): dynamic secrets (database, cloud), transit secrets engine, key versioning, audit logging, HSM backing.
- Cloud KMS: AWS Secrets Manager / KMS, GCP Secret Manager / Cloud KMS, Azure Key Vault; use for cloud-native workloads.
- Hybrid approach: Vault for dynamic secrets and complex policies; cloud KMS for envelope encryption and workload-specific secrets.
- High availability: Vault cluster (3+ nodes); cloud KMS is managed and HA by default.
- Access control: policies restricting who can read / write / rotate each secret; break-glass access for emergencies.
Completion criterion: architecture diagram saved; tool selection justified.
3. Secrets injection methods
- Kubernetes:
- External Secrets Operator (ESO): sync secrets from Vault / cloud manager into Kubernetes Secrets; watch for changes.
- CSI Secrets Store: mount secrets as files via volume; in-memory tmpfs; no etcd persistence for sensitive values.
- Workload Identity / IRSA: use short-lived cloud credentials instead of long-lived keys.
- VMs and serverless:
- Vault Agent: sidecar or init container injecting secrets into process environment or file.
- Cloud-init / metadata service: avoid IMDSv1; use IMDSv2 with token; restrict metadata access via network policy.
- Environment variables: avoid for high-sensitivity secrets; use file-based injection with restricted permissions.
- CI/CD:
- Short-lived credentials from Vault or cloud IAM; never hardcode secrets in pipeline definitions.
- Use OIDC federation (GitHub Actions, GitLab CI) to assume roles without long-lived keys.
Completion criterion: injection design documented per runtime; least-leakage method selected.
4. Rotation strategy
- Automatic rotation: use Vault dynamic secrets (database, cloud) for automatic rotation without downtime; short TTL (e.g., 1 hour) with renewal.
- Scheduled rotation: static secrets (API keys, certificates) on fixed schedule (90 days for API keys; annual for certificates; 30 days for high-sensitivity).
- Rotation procedures: playbook for manual rotation; coordinate with dependent services to avoid downtime.
- Versioning: keep previous secret version available during rotation window; revoke old version after confirmation.
- Emergency rotation: break-glass procedure for suspected compromise; revoke and regenerate immediately.
Completion criterion: rotation schedule saved per secret type; playbook documented.
5. Encryption at rest for secrets stores
- etcd encryption: enable KMS envelope encryption for Kubernetes secrets at rest; use cloud KMS or Vault as KMS provider.
- Vault storage: encrypted at rest (AES-256-GCM); seal / unseal with Shamir's secret sharing or cloud KMS auto-unseal.
- Backup encryption: encrypt secret store backups; store in separate location with separate access controls.
Completion criterion: encryption at rest design documented; key management for secrets store defined.
6. Audit and leakage prevention
- Static analysis: scan code, IaC, and container images for hardcoded secrets (git-secrets, truffleHog, gitleaks, detect-secrets).
- Vault audit logs: log all secret access (read, write, delete); alert on unusual patterns (bulk reads, access from new IPs).
- Cloud audit logs: log access to Secrets Manager / Key Vault; correlate with IAM activity.
- Leak response: runbook for exposed secrets (rotate, revoke, audit access logs, notify owners, assess blast radius).
Completion criterion: audit findings documented; leakage prevention controls in place; runbook saved.
7. Compliance mapping
- SOC 2: CC6.1 (logical access), CC6.7 (restrict transmission), CC6.8 (prevent unauthorised software).
- PCI-DSS: req 3 (protect stored cardholder data), req 7 (restrict access), req 8 (identify and authenticate).
- HIPAA: 164.312(a) (access control), 164.312(c) (integrity), 164.312(e)(1) (transmission security).
- CIS Controls: Control 4 (secure configuration), Control 6 (access control), Control 16 (application software security).
Completion criterion: compliance checklist complete; gaps documented.
Rules
- Rule: never hardcode secrets in source code, IaC, container images, or environment variables; use a central secrets store.
- Rule: use short-lived dynamic secrets wherever possible; static secrets require explicit justification and rotation schedule.
- Rule: enforce least-privilege access to secrets stores; audit all secret reads and writes; alert on anomalies.
- Rule: encrypt secrets at rest in etcd, Vault storage, and backups; use KMS envelope encryption with separate key per environment.
- Rule: scan all code, IaC, and images for hardcoded secrets before merge; block if critical secrets found.
- Rule: rotate all static secrets on a defined schedule; emergency rotation runbook tested quarterly.
- Rule: avoid IMDSv1 and metadata service access from containers; use workload identity and short-lived tokens instead.
Completion
- the skill's completion criteria are explicitly checked
- the artifact is saved and validated
- any blockers or skipped validations are documented
- the next consumer is identified or the work is handed off
@include .agents/skills/platform/contract-base.xml
1---2name: "secret-management-security"3category: "sec"4maturity: "stable"5version: "1"6description: "Secrets management (Vault, KMS, rotation, injection, external secrets operator)"7license: "MIT"8capabilities:9 - apply secret management security methods within explicit sec boundaries10 - analyze secrets management (vault, kms, rotation, injection, external secrets operator) with assumptions, constraints, and failure modes11 - produce and validate a sec artifact with evidence, decisions, and next steps12outputs: "secrets management architecture + rotation schedule + injection design + audit findings."13sideEffects: []14dependencies: []15stopCondition: "Secrets architecture saved; rotation schedule defined; injection design documented; audit complete."16risk: "medium"17trustTier: "3"18maxIterations: "6"19promptVersion: "2.0"20artifactType: "security"21modelTier: "reasoning"22evaluators: ["behavioral", "regression"]23fixturesPath: .agents/skills/platform/fixtures/behavioral/secret-management-security.json24diataxis: "how-to"25tags: ["sec"]26compatibility: []27approvalRequired: "true"28approvalFor: []29metadata:30 source: https://skillmd.com/skills/quantumquirkxyz/secret-management-security31---3233## Contract3435- Input: secret types (API keys, database credentials, certificates, tokens), runtime environments (Kubernetes, VMs, serverless), compliance requirements.36- Output: secrets management architecture + rotation schedule + injection design + audit findings.37- Scope: designs and audits secrets management; does not rotate live production secrets without explicit approval.38- Rule: designs and audits secrets management; does not rotate live production secrets without explicit approval.39- Rule: documented standards override defaults; explicit project rules take precedence.40- Rule: if blocked by missing context or dependencies, surface the blocker before proceeding.4142## Provenance4344| Question | Answer |45|---|---|46| What is the source of truth? | The user's request, originating spec/issue, and the skill's declared outputs |47| What is in scope? | Work covered by the skill's acceptance criteria and completion rules |48| What is explicitly out of scope? | Files, behaviors, and decisions outside the skill's declared boundary |49| Who or what consumes this artifact afterward? | The next skill in the workflow or the user |50| What evidence proves it is done? | Completion criteria met, artifact saved, validation passed |51| What risk remains? | Subjective judgment calls, missing context, or external dependency failures525354## Artifact5556Emit `SecretManagementSecurityArtifact` as both:57- JSON: `.agents/skills/platform/artifacts/secret-management-security/{identifier}.json`58- Markdown view: same filename with `.md` extension596061# 62# 63# Secret Management Security6465Design and audit **secrets management** — Vault, KMS, rotation, injection, and External Secrets Operator — with explicit lifecycle controls and leakage prevention.6667## Process6869### 1. Secrets inventory and classification70- Enumerate all secrets: API keys, database credentials, TLS certificates, OAuth tokens, service account keys, signing keys.71- Classify by sensitivity: low (public API key with rate limit), medium (internal service key), high (database root, signing key).72- Map secret owners, rotation schedules, and storage locations.7374**Completion criterion:** secrets inventory and classification saved.7576### 2. Secrets management architecture77- **Vault (HashiCorp):** dynamic secrets (database, cloud), transit secrets engine, key versioning, audit logging, HSM backing.78- **Cloud KMS:** AWS Secrets Manager / KMS, GCP Secret Manager / Cloud KMS, Azure Key Vault; use for cloud-native workloads.79- **Hybrid approach:** Vault for dynamic secrets and complex policies; cloud KMS for envelope encryption and workload-specific secrets.80- **High availability:** Vault cluster (3+ nodes); cloud KMS is managed and HA by default.81- **Access control:** policies restricting who can read / write / rotate each secret; break-glass access for emergencies.8283**Completion criterion:** architecture diagram saved; tool selection justified.8485### 3. Secrets injection methods86- **Kubernetes:**87 - External Secrets Operator (ESO): sync secrets from Vault / cloud manager into Kubernetes Secrets; watch for changes.88 - CSI Secrets Store: mount secrets as files via volume; in-memory tmpfs; no etcd persistence for sensitive values.89 - Workload Identity / IRSA: use short-lived cloud credentials instead of long-lived keys.90- **VMs and serverless:**91 - Vault Agent: sidecar or init container injecting secrets into process environment or file.92 - Cloud-init / metadata service: avoid IMDSv1; use IMDSv2 with token; restrict metadata access via network policy.93 - Environment variables: avoid for high-sensitivity secrets; use file-based injection with restricted permissions.94- **CI/CD:**95 - Short-lived credentials from Vault or cloud IAM; never hardcode secrets in pipeline definitions.96 - Use OIDC federation (GitHub Actions, GitLab CI) to assume roles without long-lived keys.9798**Completion criterion:** injection design documented per runtime; least-leakage method selected.99100### 4. Rotation strategy101- **Automatic rotation:** use Vault dynamic secrets (database, cloud) for automatic rotation without downtime; short TTL (e.g., 1 hour) with renewal.102- **Scheduled rotation:** static secrets (API keys, certificates) on fixed schedule (90 days for API keys; annual for certificates; 30 days for high-sensitivity).103- **Rotation procedures:** playbook for manual rotation; coordinate with dependent services to avoid downtime.104- **Versioning:** keep previous secret version available during rotation window; revoke old version after confirmation.105- **Emergency rotation:** break-glass procedure for suspected compromise; revoke and regenerate immediately.106107**Completion criterion:** rotation schedule saved per secret type; playbook documented.108109### 5. Encryption at rest for secrets stores110- **etcd encryption:** enable KMS envelope encryption for Kubernetes secrets at rest; use cloud KMS or Vault as KMS provider.111- **Vault storage:** encrypted at rest (AES-256-GCM); seal / unseal with Shamir's secret sharing or cloud KMS auto-unseal.112- **Backup encryption:** encrypt secret store backups; store in separate location with separate access controls.113114**Completion criterion:** encryption at rest design documented; key management for secrets store defined.115116### 6. Audit and leakage prevention117- **Static analysis:** scan code, IaC, and container images for hardcoded secrets (git-secrets, truffleHog, gitleaks, detect-secrets).118- **Vault audit logs:** log all secret access (read, write, delete); alert on unusual patterns (bulk reads, access from new IPs).119- **Cloud audit logs:** log access to Secrets Manager / Key Vault; correlate with IAM activity.120- **Leak response:** runbook for exposed secrets (rotate, revoke, audit access logs, notify owners, assess blast radius).121122**Completion criterion:** audit findings documented; leakage prevention controls in place; runbook saved.123124### 7. Compliance mapping125- **SOC 2:** CC6.1 (logical access), CC6.7 (restrict transmission), CC6.8 (prevent unauthorised software).126- **PCI-DSS:** req 3 (protect stored cardholder data), req 7 (restrict access), req 8 (identify and authenticate).127- **HIPAA:** 164.312(a) (access control), 164.312(c) (integrity), 164.312(e)(1) (transmission security).128- **CIS Controls:** Control 4 (secure configuration), Control 6 (access control), Control 16 (application software security).129130**Completion criterion:** compliance checklist complete; gaps documented.131132## Rules133134- Rule: never hardcode secrets in source code, IaC, container images, or environment variables; use a central secrets store.135- Rule: use short-lived dynamic secrets wherever possible; static secrets require explicit justification and rotation schedule.136- Rule: enforce least-privilege access to secrets stores; audit all secret reads and writes; alert on anomalies.137- Rule: encrypt secrets at rest in etcd, Vault storage, and backups; use KMS envelope encryption with separate key per environment.138- Rule: scan all code, IaC, and images for hardcoded secrets before merge; block if critical secrets found.139- Rule: rotate all static secrets on a defined schedule; emergency rotation runbook tested quarterly.140- Rule: avoid IMDSv1 and metadata service access from containers; use workload identity and short-lived tokens instead.141142## Completion143144- the skill's completion criteria are explicitly checked145- the artifact is saved and validated146- any blockers or skipped validations are documented147- the next consumer is identified or the work is handed off148---149@include .agents/skills/platform/contract-base.xml