跳到主要内容
SkillVault logo SkillVault
免费 ChatGPT GPTs Claude Code Cursor

secrets-vault-manager

Use when the user asks to set up secret management infrastructure, integrate HashiCorp Vault, configure cloud secret stores (AWS Secrets Manager, Azure Key Vault, GCP Secret Manager), implement secret rotation, or audit secret access patterns.

0 次下载 0 次浏览 更新于 Oct 31, 2026 v1.0.0
secrets-vault-manager skill cover

下方技能配置(提示词、变量、安装步骤)保留英文原文。.aiskill 文件直接面向 AI 智能体,统一使用英文以确保跨平台行为一致。

概述

Use when the user asks to set up secret management infrastructure, integrate HashiCorp Vault, configure cloud secret stores (AWS Secrets Manager, Azure Key Vault, GCP Secret Manager), implement secret rotation, or audit secret access patterns.

Source: https://github.com/alirezarezvani/claude-skills · MIT · © 2025 Alireza Rezvani

系统提示词

定义智能体角色、规则与输出格式的指令块。

system-prompt.txt
# Secrets Vault Manager

**Tier:** POWERFUL
**Category:** Engineering
**Domain:** Security / Infrastructure / DevOps

---

## Overview

Production secret infrastructure management for teams running HashiCorp Vault, cloud-native secret stores, or hybrid architectures. This skill covers policy authoring, auth method configuration, automated rotation, dynamic secrets, audit logging, and incident response.

**Distinct from env-secrets-manager** which handles local `.env` file hygiene and leak detection. This skill operates at the infrastructure layer — Vault clusters, cloud KMS, certificate authorities, and CI/CD secret injection.

### When to Use

- Standing up a new Vault cluster or migrating to a managed secret store
- Designing auth methods for services, CI runners, and human operators
- Implementing automated credential rotation (database, API keys, certificates)
- Auditing secret access patterns for compliance (SOC 2, ISO 27001, HIPAA)
- Responding to a secret leak that requires mass revocation
- Integrating secrets into Kubernetes workloads or CI/CD pipelines

---

## HashiCorp Vault Patterns

### Architecture Decisions

| Decision | Recommendation | Rationale |
|----------|---------------|-----------|
| Deployment mode | HA with Raft storage | No external dependency, built-in leader election |
| Auto-unseal | Cloud KMS (AWS KMS / Azure Key Vault / GCP KMS) | Eliminates manual unseal, enables automated restarts |
| Namespaces | One per environment (dev/staging/prod) | Blast-radius isolation, independent policies |
| Audit devices | File + syslog (dual) | Vault refuses requests if all audit devices fail — dual prevents outages |

### Auth Methods

**AppRole** — Machine-to-machine authentication for services and batch jobs.

```hcl
# Enable AppRole
path "auth/approle/*" {
  capabilities = ["create", "read", "update", "delete", "list"]
}

# Application-specific role
vault write auth/approle/role/payment-service \
  token_ttl=1h \
  token_max_ttl=4h \
  secret_id_num_uses=1 \
  secret_id_ttl=10m \
  token_policies="payment-service-read"
```

**Kubernetes** — Pod-native authentication via service account tokens.

```hcl
vault write auth/kubernetes/role/api-server \
  bound_service_account_names=api-server \
  bound_service_account_namespaces=production \
  policies=api-server-secrets \
  ttl=1h
```

**OIDC** — Human operator access via SSO provider (Okta, Azure AD, Google Workspace).

```hcl
vault write auth/oidc/role/engineering \
  bound_audiences="vault" \
  allowed_redirect_uris="https://vault.example.com/ui/vault/auth/oidc/oidc/callback" \
  user_claim="email" \
  oidc_scopes="openid,profile,email" \
  policies="engineering-read" \
  ttl=8h
```

### Secret Engines

| Engine | Use Case | TTL Strategy |
|--------|----------|-------------|
| KV v2 | Static secrets (API keys, config) | Versioned, manual rotation |
| Database | Dynamic DB credentials | 1h default, 24h max |
| PKI | TLS certificates | 90d leaf certs, 5y intermediate CA |
| Transit | Encryption-as-a-service | Key rotation every 90d |
| SSH | Signed SSH certificates | 30m for interactive, 8h for automation |

### Policy Design

Follow least-privilege with path-based granularity:

```hcl
# payment-service-read policy
path "secret/data/production/payment/*" {
  capabilities = ["read"]
}

path "database/creds/payment-readonly" {
  capabilities = ["read"]
}

# Deny access to admin paths explicitly
path "sys/*" {
  capabilities = ["deny"]
}
```

**Policy naming convention:** `{service}-{access-level}` (e.g., `payment-service-read`, `api-gateway-admin`).

---

## Cloud Secret Store Integration

### Comparison Matrix

| Feature | AWS Secrets Manager | Azure Key Vault | GCP Secret Manager |
|---------|--------------------|-----------------|--------------------|
| Rotation | Built-in Lambda | Custom logic via Functions | Cloud Functions |
| Versioning | Automatic | Manual or automatic | Automatic |
| Encryption | AWS KMS (default or CMK) | HSM-backed | Google-managed or CMEK |
| Access control | IAM policies + resource policy | RBAC + Access Policies | IAM bindings |
| Cross-region | Replication supported | Geo-redundant by default | Replication supported |
| Audit | CloudTrail | Azure Monitor + Diagnostic Logs | Cloud Audit Logs |
| Pricing model | Per-secret + per-API call | Per-operation + per-key | Per-secret version + per-access |

### When to Use Which

- **AWS Secrets Manager**: RDS/Aurora credential rotation out of the box. Best when fully on AWS.
- **Azure Key Vault**: Certificate management strength. Required for Azure AD integrated workloads.
- **GCP Secret Manager**: Simplest API surface. Best for GKE-native workloads with Workload Identity.
- **HashiCorp Vault**: Multi-cloud, dynamic secrets, PKI, transit encryption. Best for complex or hybrid environments.

### SDK Access Patterns

**Principle:** Always fetch secrets at startup or via sidecar — never bake into images or config files.

```python
# AWS Secrets Manager pattern
import boto3, json

def get_secret(secret_name, region="us-east-1"):
    client = boto3.client("secretsmanager", region_name=region)
    response = client.get_secret_value(SecretId=secret_name)
    return json.loads(response["SecretString"])
```

```python
# GCP Secret Manager pattern
from google.cloud import secretmanager

def get_secret(project_id, secret_id, version="latest"):
    client = secretmanager.SecretManagerServiceClient()
    name = f"projects/{project_id}/secrets/{secret_id}/versions/{version}"
    response = client.access_secret_version(request={"name": name})
    return response.payload.data.decode("UTF-8")
```

```python
# Azure Key Vault pattern
from azure.identity import DefaultAzureCredential
from azure.keyvault.secrets import SecretClient

def get_secret(vault_url, secret_name):
    credential = DefaultAzureCredential()
    client = SecretClient(vault_url=vault_url, credential=credential)
    return client.get_secret(secret_name).value
```

---

## Secret Rotation Workflows

### Rotation Strategy by Secret Type

| Secret Type | Rotation Frequency | Method | Downtime Risk |
|-------------|-------------------|--------|---------------|
| Database passwords | 30 days | Dual-account swap | Zero (A/B rotation) |
| API keys | 90 days | Generate new, deprecate old | Zero (overlap window) |
| TLS certificates | 60 days before expiry | ACME or Vault PKI | Zero (graceful reload) |
| SSH keys | 90 days | Vault-signed certificates | Zero (CA-based) |
| Service tokens | 24 hours | Dynamic generation | Zero (short-lived) |
| Encryption keys | 90 days | Key versioning (rewrap) | Zero (version coexistence) |

### Database Credential Rotation (Dual-Account)

1. Two database accounts exist: `app_user_a` and `app_user_b`
2. Application currently uses `app_user_a`
3. Rotation rotates `app_user_b` password, updates secret store
4. Application switches to `app_user_b` on next credential fetch
5. After grace period, `app_user_a` password is rotated
6. Cycle repeats

### API Key Rotation (Overlap Window)

1. Generate new API key with provider
2. Store new key in secret store as `current`, move old to `previous`
3. Deploy applications — they read `current`
4. After all instances restarted (or TTL expired), revoke `previous`
5. Monitoring confirms zero usage of old key before revocation

---

## Dynamic Secrets

Dynamic secrets are generated on-demand with automatic expiration. Prefer dynamic secrets over static credentials wherever possible.

### Database Dynamic Credentials (Vault)

```hcl
# Configure database engine
vault write database/config/postgres \
  plugin_name=postgresql-database-plugin \
  connection_url="postgresql://{{username}}:{{password}}@db.example.com:5432/app" \
  allowed_roles="app-readonly,app-readwrite" \
  username="vault_admin" \
  password="<admin-password>"

# Create role with TTL
vault write database/roles/app-readonly \
  db_name=postgres \
  creation_statements="CREATE ROLE \"{{name}}\" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}'; GRANT SELECT ON ALL TABLES IN SCHEMA public TO \"{{name}}\";" \
  default_ttl=1h \
  max_ttl=24h
```

### Cloud IAM Dynamic Credentials

Vault can generate short-lived AWS IAM credentials, Azure service principal passwords, or GCP service account keys — eliminating long-lived cloud credentials entirely.

### SSH Certificate Authority

Replace SSH key distribution with a Vault-signed certificate model:

1. Vault acts as SSH CA
2. Users/machines request signed certificates with short TTL (30 min)
3. SSH servers trust the CA public key — no `authorized_keys` management
4. Certificates expire automatically — no revocation needed for normal operations

---

## Audit Logging

### What to Log

| Event | Priority | Retention |
|-------|----------|-----------|
| Secret read access | HIGH | 1 year minimum |
| Secret creation/update | HIGH | 1 year minimum |
| Auth method login | MEDIUM | 90 days |
| Policy changes | CRITICAL | 2 years (compliance) |
| Failed access attempts | CRITICAL | 1 year |
| Token creation/revocation | MEDIUM | 90 days |
| Seal/unseal operations | CRITICAL | Indefinite |

### Anomaly Detection Signals

- Secret accessed from new IP/CIDR range
- Access volume spike (>3x baseline for a path)
- Off-hours access for human auth methods
- Service accessing secrets outside its policy scope (denied requests)
- Multiple failed auth attempts from single source
- Token created with unusually long TTL

### Compliance Reporting

Generate periodic reports covering:

1. **Access inventory** — Which identities accessed which secrets, when
2. **Rotation compliance** — Secrets overdue for rotation
3. **Policy drift** — Policies modified since last review
4. **Orphaned secrets** — Secrets with no recent access (>90 days)

Use `audit_log_analyzer.py` to parse Vault or cloud audit logs for these signals.

---

## Emergency Procedures

### Secret Leak Response (Immediate)

**Time target: Contain within 15 minutes of detection.**

1. **Identify scope** — Which secret(s) leaked, where (repo, log, error message, third party)
2. **Revoke immediately** — Rotate the compromised credential at the source (provider API, Vault, cloud SM)
3. **Invalidate tokens** — Revoke all Vault tokens that accessed the leaked secret
4. **Audit blast radius** — Query audit logs for usage of the compromised secret in the exposure window
5. **Notify stakeholders** — Security team, affected service owners, compliance (if PII/regulated data)
6. **Post-mortem** — Document root cause, update controls to prevent recurrence

### Vault Seal Operations

**When to seal:** Active security incident affecting Vault infrastructure, suspected key compromise.

**Sealing** stops all Vault operations. Use only as last resort.

**Unseal procedure:**
1. Gather quorum of unseal key holders (Shamir threshold)
2. Or confirm auto-unseal KMS key is accessible
3. Unseal via `vault operator unseal` or restart with auto-unseal
4. Verify audit devices reconnected
5. Check active leases and token validity

See `references/emergency_procedures.md` for complete playbooks.

---

## CI/CD Integration

### Vault Agent Sidecar (Kubernetes)

Vault Agent runs alongside application pods, handles authentication and secret rendering:

```yaml
# Pod annotation for Vault Agent Injector
annotations:
  vault.hashicorp.com/agent-inject: "true"
  vault.hashicorp.com/role: "api-server"
  vault.hashicorp.com/agent-inject-secret-db: "database/creds/app-readonly"
  vault.hashicorp.com/agent-inject-template-db: |
    {{- with secret "database/creds/app-readonly" -}}
    postgresql://{{ .Data.username }}:{{ .Data.password }}@db:5432/app
    {{- end }}
```

### External Secrets Operator (Kubernetes)

For teams preferring declarative GitOps over agent sidecars:

```yaml
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
  name: api-credentials
spec:
  refreshInterval: 1h
  secretStoreRef:
    name: vault-backend
    kind: ClusterSecretStore
  target:
    name: api-credentials
  data:
    - secretKey: api-key
      remoteRef:
        key: secret/data/production/api
        property: key
```

### GitHub Actions OIDC

Eliminate long-lived secrets in CI by using OIDC federation:

```yaml
- name: Authenticate to Vault
  uses: hashicorp/vault-action@v2
  with:
    url: https://vault.example.com
    method: jwt
    role: github-ci
    jwtGithubAudience: https://vault.example.com
    secrets: |
      secret/data/ci/deploy api_key | DEPLOY_API_KEY ;
      secret/data/ci/deploy db_password | DB_PASSWORD
```

---

## Anti-Patterns

| Anti-Pattern | Risk | Correct Approach |
|-------------|------|-----------------|
| Hardcoded secrets in source code | Leak via repo, logs, error output | Fetch from secret store at runtime |
| Long-lived static tokens (>30 days) | Stale credentials, no accountability | Dynamic secrets or short TTL + rotation |
| Shared service accounts | No audit trail per consumer | Per-service identity with unique credentials |
| No rotation policy | Compromised creds persist indefinitely | Automated rotation on schedule |
| Secrets in environment variables on CI | Visible in build logs, process table | Vault Agent or OIDC-based injection |
| Single unseal key holder | Bus factor of 1, recovery blocked | Shamir split (3-of-5) or auto-unseal |
| No audit device configured | Zero visibility into access | Dual audit devices (file + syslog) |
| Wildcard policies (`path "*"`) | Over-permissioned, violates least privilege | Explicit path-based policies per service |

---

## Tools

| Script | Purpose |
|--------|---------|
| `vault_config_generator.py` | Generate Vault policy and auth config from application requirements |
| `rotation_planner.py` | Create rotation schedule from a secret inventory file |
| `audit_log_analyzer.py` | Analyze audit logs for anomalies and compliance gaps |

---

## Cross-References

- **env-secrets-manager** — Local `.env` file hygiene, leak detection, drift awareness
- **senior-secops** — Security operations, incident response, threat modeling
- **ci-cd-pipeline-builder** — Pipeline design where secrets are consumed
- **docker-development** — Container secret injection patterns
- **helm-chart-builder** — Kubernetes secret management in Helm charts

用户提示词模板

填充变量后发送,即可运行该技能: {{variables}}

user-template.txt

变量

名称 必填 说明 示例

完整技能配置

标准 .aiskill 文件,提供 JSON 与 YAML 两种格式。

secrets-vault-manager.aiskill (JSON)
{
  "format": "aiskill/v1",
  "skill": {
    "name": "secrets-vault-manager",
    "slug": "secrets-vault-manager",
    "version": "1.0.0",
    "description": "Use when the user asks to set up secret management infrastructure, integrate HashiCorp Vault, configure cloud secret stores (AWS Secrets Manager, Azure Key Vault, GCP Secret Manager), implement secret rotation, or audit secret access patterns.",
    "category": "Development",
    "tags": [
      "engineering",
      "infrastructure",
      "security"
    ],
    "platforms": [
      "chatgpt",
      "claude-code",
      "cursor"
    ],
    "tested_environment": "Agent Skills convention (SKILL.md) — works with Claude Code, Cursor, ChatGPT/Codex and compatible agents",
    "license": "MIT"
  },
  "prompts": {
    "system": "# Secrets Vault Manager\r\n\r\n**Tier:** POWERFUL\r\n**Category:** Engineering\r\n**Domain:** Security / Infrastructure / DevOps\r\n\r\n---\r\n\r\n## Overview\r\n\r\nProduction secret infrastructure management for teams running HashiCorp Vault, cloud-native secret stores, or hybrid architectures. This skill covers policy authoring, auth method configuration, automated rotation, dynamic secrets, audit logging, and incident response.\r\n\r\n**Distinct from env-secrets-manager** which handles local `.env` file hygiene and leak detection. This skill operates at the infrastructure layer — Vault clusters, cloud KMS, certificate authorities, and CI/CD secret injection.\r\n\r\n### When to Use\r\n\r\n- Standing up a new Vault cluster or migrating to a managed secret store\r\n- Designing auth methods for services, CI runners, and human operators\r\n- Implementing automated credential rotation (database, API keys, certificates)\r\n- Auditing secret access patterns for compliance (SOC 2, ISO 27001, HIPAA)\r\n- Responding to a secret leak that requires mass revocation\r\n- Integrating secrets into Kubernetes workloads or CI/CD pipelines\r\n\r\n---\r\n\r\n## HashiCorp Vault Patterns\r\n\r\n### Architecture Decisions\r\n\r\n| Decision | Recommendation | Rationale |\r\n|----------|---------------|-----------|\r\n| Deployment mode | HA with Raft storage | No external dependency, built-in leader election |\r\n| Auto-unseal | Cloud KMS (AWS KMS / Azure Key Vault / GCP KMS) | Eliminates manual unseal, enables automated restarts |\r\n| Namespaces | One per environment (dev/staging/prod) | Blast-radius isolation, independent policies |\r\n| Audit devices | File + syslog (dual) | Vault refuses requests if all audit devices fail — dual prevents outages |\r\n\r\n### Auth Methods\r\n\r\n**AppRole** — Machine-to-machine authentication for services and batch jobs.\r\n\r\n```hcl\r\n# Enable AppRole\r\npath \"auth/approle/*\" {\r\n  capabilities = [\"create\", \"read\", \"update\", \"delete\", \"list\"]\r\n}\r\n\r\n# Application-specific role\r\nvault write auth/approle/role/payment-service \\\r\n  token_ttl=1h \\\r\n  token_max_ttl=4h \\\r\n  secret_id_num_uses=1 \\\r\n  secret_id_ttl=10m \\\r\n  token_policies=\"payment-service-read\"\r\n```\r\n\r\n**Kubernetes** — Pod-native authentication via service account tokens.\r\n\r\n```hcl\r\nvault write auth/kubernetes/role/api-server \\\r\n  bound_service_account_names=api-server \\\r\n  bound_service_account_namespaces=production \\\r\n  policies=api-server-secrets \\\r\n  ttl=1h\r\n```\r\n\r\n**OIDC** — Human operator access via SSO provider (Okta, Azure AD, Google Workspace).\r\n\r\n```hcl\r\nvault write auth/oidc/role/engineering \\\r\n  bound_audiences=\"vault\" \\\r\n  allowed_redirect_uris=\"https://vault.example.com/ui/vault/auth/oidc/oidc/callback\" \\\r\n  user_claim=\"email\" \\\r\n  oidc_scopes=\"openid,profile,email\" \\\r\n  policies=\"engineering-read\" \\\r\n  ttl=8h\r\n```\r\n\r\n### Secret Engines\r\n\r\n| Engine | Use Case | TTL Strategy |\r\n|--------|----------|-------------|\r\n| KV v2 | Static secrets (API keys, config) | Versioned, manual rotation |\r\n| Database | Dynamic DB credentials | 1h default, 24h max |\r\n| PKI | TLS certificates | 90d leaf certs, 5y intermediate CA |\r\n| Transit | Encryption-as-a-service | Key rotation every 90d |\r\n| SSH | Signed SSH certificates | 30m for interactive, 8h for automation |\r\n\r\n### Policy Design\r\n\r\nFollow least-privilege with path-based granularity:\r\n\r\n```hcl\r\n# payment-service-read policy\r\npath \"secret/data/production/payment/*\" {\r\n  capabilities = [\"read\"]\r\n}\r\n\r\npath \"database/creds/payment-readonly\" {\r\n  capabilities = [\"read\"]\r\n}\r\n\r\n# Deny access to admin paths explicitly\r\npath \"sys/*\" {\r\n  capabilities = [\"deny\"]\r\n}\r\n```\r\n\r\n**Policy naming convention:** `{service}-{access-level}` (e.g., `payment-service-read`, `api-gateway-admin`).\r\n\r\n---\r\n\r\n## Cloud Secret Store Integration\r\n\r\n### Comparison Matrix\r\n\r\n| Feature | AWS Secrets Manager | Azure Key Vault | GCP Secret Manager |\r\n|---------|--------------------|-----------------|--------------------|\r\n| Rotation | Built-in Lambda | Custom logic via Functions | Cloud Functions |\r\n| Versioning | Automatic | Manual or automatic | Automatic |\r\n| Encryption | AWS KMS (default or CMK) | HSM-backed | Google-managed or CMEK |\r\n| Access control | IAM policies + resource policy | RBAC + Access Policies | IAM bindings |\r\n| Cross-region | Replication supported | Geo-redundant by default | Replication supported |\r\n| Audit | CloudTrail | Azure Monitor + Diagnostic Logs | Cloud Audit Logs |\r\n| Pricing model | Per-secret + per-API call | Per-operation + per-key | Per-secret version + per-access |\r\n\r\n### When to Use Which\r\n\r\n- **AWS Secrets Manager**: RDS/Aurora credential rotation out of the box. Best when fully on AWS.\r\n- **Azure Key Vault**: Certificate management strength. Required for Azure AD integrated workloads.\r\n- **GCP Secret Manager**: Simplest API surface. Best for GKE-native workloads with Workload Identity.\r\n- **HashiCorp Vault**: Multi-cloud, dynamic secrets, PKI, transit encryption. Best for complex or hybrid environments.\r\n\r\n### SDK Access Patterns\r\n\r\n**Principle:** Always fetch secrets at startup or via sidecar — never bake into images or config files.\r\n\r\n```python\r\n# AWS Secrets Manager pattern\r\nimport boto3, json\r\n\r\ndef get_secret(secret_name, region=\"us-east-1\"):\r\n    client = boto3.client(\"secretsmanager\", region_name=region)\r\n    response = client.get_secret_value(SecretId=secret_name)\r\n    return json.loads(response[\"SecretString\"])\r\n```\r\n\r\n```python\r\n# GCP Secret Manager pattern\r\nfrom google.cloud import secretmanager\r\n\r\ndef get_secret(project_id, secret_id, version=\"latest\"):\r\n    client = secretmanager.SecretManagerServiceClient()\r\n    name = f\"projects/{project_id}/secrets/{secret_id}/versions/{version}\"\r\n    response = client.access_secret_version(request={\"name\": name})\r\n    return response.payload.data.decode(\"UTF-8\")\r\n```\r\n\r\n```python\r\n# Azure Key Vault pattern\r\nfrom azure.identity import DefaultAzureCredential\r\nfrom azure.keyvault.secrets import SecretClient\r\n\r\ndef get_secret(vault_url, secret_name):\r\n    credential = DefaultAzureCredential()\r\n    client = SecretClient(vault_url=vault_url, credential=credential)\r\n    return client.get_secret(secret_name).value\r\n```\r\n\r\n---\r\n\r\n## Secret Rotation Workflows\r\n\r\n### Rotation Strategy by Secret Type\r\n\r\n| Secret Type | Rotation Frequency | Method | Downtime Risk |\r\n|-------------|-------------------|--------|---------------|\r\n| Database passwords | 30 days | Dual-account swap | Zero (A/B rotation) |\r\n| API keys | 90 days | Generate new, deprecate old | Zero (overlap window) |\r\n| TLS certificates | 60 days before expiry | ACME or Vault PKI | Zero (graceful reload) |\r\n| SSH keys | 90 days | Vault-signed certificates | Zero (CA-based) |\r\n| Service tokens | 24 hours | Dynamic generation | Zero (short-lived) |\r\n| Encryption keys | 90 days | Key versioning (rewrap) | Zero (version coexistence) |\r\n\r\n### Database Credential Rotation (Dual-Account)\r\n\r\n1. Two database accounts exist: `app_user_a` and `app_user_b`\r\n2. Application currently uses `app_user_a`\r\n3. Rotation rotates `app_user_b` password, updates secret store\r\n4. Application switches to `app_user_b` on next credential fetch\r\n5. After grace period, `app_user_a` password is rotated\r\n6. Cycle repeats\r\n\r\n### API Key Rotation (Overlap Window)\r\n\r\n1. Generate new API key with provider\r\n2. Store new key in secret store as `current`, move old to `previous`\r\n3. Deploy applications — they read `current`\r\n4. After all instances restarted (or TTL expired), revoke `previous`\r\n5. Monitoring confirms zero usage of old key before revocation\r\n\r\n---\r\n\r\n## Dynamic Secrets\r\n\r\nDynamic secrets are generated on-demand with automatic expiration. Prefer dynamic secrets over static credentials wherever possible.\r\n\r\n### Database Dynamic Credentials (Vault)\r\n\r\n```hcl\r\n# Configure database engine\r\nvault write database/config/postgres \\\r\n  plugin_name=postgresql-database-plugin \\\r\n  connection_url=\"postgresql://{{username}}:{{password}}@db.example.com:5432/app\" \\\r\n  allowed_roles=\"app-readonly,app-readwrite\" \\\r\n  username=\"vault_admin\" \\\r\n  password=\"<admin-password>\"\r\n\r\n# Create role with TTL\r\nvault write database/roles/app-readonly \\\r\n  db_name=postgres \\\r\n  creation_statements=\"CREATE ROLE \\\"{{name}}\\\" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}'; GRANT SELECT ON ALL TABLES IN SCHEMA public TO \\\"{{name}}\\\";\" \\\r\n  default_ttl=1h \\\r\n  max_ttl=24h\r\n```\r\n\r\n### Cloud IAM Dynamic Credentials\r\n\r\nVault can generate short-lived AWS IAM credentials, Azure service principal passwords, or GCP service account keys — eliminating long-lived cloud credentials entirely.\r\n\r\n### SSH Certificate Authority\r\n\r\nReplace SSH key distribution with a Vault-signed certificate model:\r\n\r\n1. Vault acts as SSH CA\r\n2. Users/machines request signed certificates with short TTL (30 min)\r\n3. SSH servers trust the CA public key — no `authorized_keys` management\r\n4. Certificates expire automatically — no revocation needed for normal operations\r\n\r\n---\r\n\r\n## Audit Logging\r\n\r\n### What to Log\r\n\r\n| Event | Priority | Retention |\r\n|-------|----------|-----------|\r\n| Secret read access | HIGH | 1 year minimum |\r\n| Secret creation/update | HIGH | 1 year minimum |\r\n| Auth method login | MEDIUM | 90 days |\r\n| Policy changes | CRITICAL | 2 years (compliance) |\r\n| Failed access attempts | CRITICAL | 1 year |\r\n| Token creation/revocation | MEDIUM | 90 days |\r\n| Seal/unseal operations | CRITICAL | Indefinite |\r\n\r\n### Anomaly Detection Signals\r\n\r\n- Secret accessed from new IP/CIDR range\r\n- Access volume spike (>3x baseline for a path)\r\n- Off-hours access for human auth methods\r\n- Service accessing secrets outside its policy scope (denied requests)\r\n- Multiple failed auth attempts from single source\r\n- Token created with unusually long TTL\r\n\r\n### Compliance Reporting\r\n\r\nGenerate periodic reports covering:\r\n\r\n1. **Access inventory** — Which identities accessed which secrets, when\r\n2. **Rotation compliance** — Secrets overdue for rotation\r\n3. **Policy drift** — Policies modified since last review\r\n4. **Orphaned secrets** — Secrets with no recent access (>90 days)\r\n\r\nUse `audit_log_analyzer.py` to parse Vault or cloud audit logs for these signals.\r\n\r\n---\r\n\r\n## Emergency Procedures\r\n\r\n### Secret Leak Response (Immediate)\r\n\r\n**Time target: Contain within 15 minutes of detection.**\r\n\r\n1. **Identify scope** — Which secret(s) leaked, where (repo, log, error message, third party)\r\n2. **Revoke immediately** — Rotate the compromised credential at the source (provider API, Vault, cloud SM)\r\n3. **Invalidate tokens** — Revoke all Vault tokens that accessed the leaked secret\r\n4. **Audit blast radius** — Query audit logs for usage of the compromised secret in the exposure window\r\n5. **Notify stakeholders** — Security team, affected service owners, compliance (if PII/regulated data)\r\n6. **Post-mortem** — Document root cause, update controls to prevent recurrence\r\n\r\n### Vault Seal Operations\r\n\r\n**When to seal:** Active security incident affecting Vault infrastructure, suspected key compromise.\r\n\r\n**Sealing** stops all Vault operations. Use only as last resort.\r\n\r\n**Unseal procedure:**\r\n1. Gather quorum of unseal key holders (Shamir threshold)\r\n2. Or confirm auto-unseal KMS key is accessible\r\n3. Unseal via `vault operator unseal` or restart with auto-unseal\r\n4. Verify audit devices reconnected\r\n5. Check active leases and token validity\r\n\r\nSee `references/emergency_procedures.md` for complete playbooks.\r\n\r\n---\r\n\r\n## CI/CD Integration\r\n\r\n### Vault Agent Sidecar (Kubernetes)\r\n\r\nVault Agent runs alongside application pods, handles authentication and secret rendering:\r\n\r\n```yaml\r\n# Pod annotation for Vault Agent Injector\r\nannotations:\r\n  vault.hashicorp.com/agent-inject: \"true\"\r\n  vault.hashicorp.com/role: \"api-server\"\r\n  vault.hashicorp.com/agent-inject-secret-db: \"database/creds/app-readonly\"\r\n  vault.hashicorp.com/agent-inject-template-db: |\r\n    {{- with secret \"database/creds/app-readonly\" -}}\r\n    postgresql://{{ .Data.username }}:{{ .Data.password }}@db:5432/app\r\n    {{- end }}\r\n```\r\n\r\n### External Secrets Operator (Kubernetes)\r\n\r\nFor teams preferring declarative GitOps over agent sidecars:\r\n\r\n```yaml\r\napiVersion: external-secrets.io/v1beta1\r\nkind: ExternalSecret\r\nmetadata:\r\n  name: api-credentials\r\nspec:\r\n  refreshInterval: 1h\r\n  secretStoreRef:\r\n    name: vault-backend\r\n    kind: ClusterSecretStore\r\n  target:\r\n    name: api-credentials\r\n  data:\r\n    - secretKey: api-key\r\n      remoteRef:\r\n        key: secret/data/production/api\r\n        property: key\r\n```\r\n\r\n### GitHub Actions OIDC\r\n\r\nEliminate long-lived secrets in CI by using OIDC federation:\r\n\r\n```yaml\r\n- name: Authenticate to Vault\r\n  uses: hashicorp/vault-action@v2\r\n  with:\r\n    url: https://vault.example.com\r\n    method: jwt\r\n    role: github-ci\r\n    jwtGithubAudience: https://vault.example.com\r\n    secrets: |\r\n      secret/data/ci/deploy api_key | DEPLOY_API_KEY ;\r\n      secret/data/ci/deploy db_password | DB_PASSWORD\r\n```\r\n\r\n---\r\n\r\n## Anti-Patterns\r\n\r\n| Anti-Pattern | Risk | Correct Approach |\r\n|-------------|------|-----------------|\r\n| Hardcoded secrets in source code | Leak via repo, logs, error output | Fetch from secret store at runtime |\r\n| Long-lived static tokens (>30 days) | Stale credentials, no accountability | Dynamic secrets or short TTL + rotation |\r\n| Shared service accounts | No audit trail per consumer | Per-service identity with unique credentials |\r\n| No rotation policy | Compromised creds persist indefinitely | Automated rotation on schedule |\r\n| Secrets in environment variables on CI | Visible in build logs, process table | Vault Agent or OIDC-based injection |\r\n| Single unseal key holder | Bus factor of 1, recovery blocked | Shamir split (3-of-5) or auto-unseal |\r\n| No audit device configured | Zero visibility into access | Dual audit devices (file + syslog) |\r\n| Wildcard policies (`path \"*\"`) | Over-permissioned, violates least privilege | Explicit path-based policies per service |\r\n\r\n---\r\n\r\n## Tools\r\n\r\n| Script | Purpose |\r\n|--------|---------|\r\n| `vault_config_generator.py` | Generate Vault policy and auth config from application requirements |\r\n| `rotation_planner.py` | Create rotation schedule from a secret inventory file |\r\n| `audit_log_analyzer.py` | Analyze audit logs for anomalies and compliance gaps |\r\n\r\n---\r\n\r\n## Cross-References\r\n\r\n- **env-secrets-manager** — Local `.env` file hygiene, leak detection, drift awareness\r\n- **senior-secops** — Security operations, incident response, threat modeling\r\n- **ci-cd-pipeline-builder** — Pipeline design where secrets are consumed\r\n- **docker-development** — Container secret injection patterns\r\n- **helm-chart-builder** — Kubernetes secret management in Helm charts",
    "user_template": ""
  },
  "variables": [],
  "install": {
    "steps": [
      {
        "title": "Download & unzip",
        "detail": "Download the .zip package from SkillVault and unzip it. The secrets-vault-manager/ folder contains SKILL.md plus any companion scripts, references and assets."
      },
      {
        "title": "Copy into your agent skills directory",
        "detail": "Move the folder into your agent's skills directory — e.g. ~/.claude/skills/ (Claude Code), .codex/skills/, .cursor/skills/ or your project's .claude/skills/ folder — then restart or reload the session."
      },
      {
        "title": "Use it",
        "detail": "Describe the task in natural language; the agent loads the skill automatically when the request matches the skill description."
      }
    ]
  },
  "usage": {
    "steps": []
  },
  "metadata": {
    "author": "SkillVault",
    "source": "https://skillvault.top/skills/secrets-vault-manager",
    "exported_at": "2026-11-03T07:44:27.287Z"
  }
}
secrets-vault-manager.aiskill (YAML)
format: aiskill/v1
skill:
  name: secrets-vault-manager
  slug: secrets-vault-manager
  version: 1.0.0
  description: >-
    Use when the user asks to set up secret management infrastructure, integrate HashiCorp Vault,
    configure cloud secret stores (AWS Secrets Manager, Azure Key Vault, GCP Secret Manager),
    implement secret rotation, or audit secret access patterns.
  category: Development
  tags:
    - engineering
    - infrastructure
    - security
  platforms:
    - chatgpt
    - claude-code
    - cursor
  tested_environment: >-
    Agent Skills convention (SKILL.md) — works with Claude Code, Cursor, ChatGPT/Codex and
    compatible agents
  license: MIT
prompts:
  system: "# Secrets Vault Manager\r\n\r\n**Tier:** POWERFUL\r\n**Category:** Engineering\r\n**Domain:** Security / Infrastructure / DevOps\r\n\r\n---\r\n\r\n## Overview\r\n\r\nProduction secret infrastructure management for teams running HashiCorp Vault, cloud-native secret stores, or hybrid architectures. This skill covers policy authoring, auth method configuration, automated rotation, dynamic secrets, audit logging, and incident response.\r\n\r\n**Distinct from env-secrets-manager** which handles local `.env` file hygiene and leak detection. This skill operates at the infrastructure layer — Vault clusters, cloud KMS, certificate authorities, and CI/CD secret injection.\r\n\r\n### When to Use\r\n\r\n- Standing up a new Vault cluster or migrating to a managed secret store\r\n- Designing auth methods for services, CI runners, and human operators\r\n- Implementing automated credential rotation (database, API keys, certificates)\r\n- Auditing secret access patterns for compliance (SOC 2, ISO 27001, HIPAA)\r\n- Responding to a secret leak that requires mass revocation\r\n- Integrating secrets into Kubernetes workloads or CI/CD pipelines\r\n\r\n---\r\n\r\n## HashiCorp Vault Patterns\r\n\r\n### Architecture Decisions\r\n\r\n| Decision | Recommendation | Rationale |\r\n|----------|---------------|-----------|\r\n| Deployment mode | HA with Raft storage | No external dependency, built-in leader election |\r\n| Auto-unseal | Cloud KMS (AWS KMS / Azure Key Vault / GCP KMS) | Eliminates manual unseal, enables automated restarts |\r\n| Namespaces | One per environment (dev/staging/prod) | Blast-radius isolation, independent policies |\r\n| Audit devices | File + syslog (dual) | Vault refuses requests if all audit devices fail — dual prevents outages |\r\n\r\n### Auth Methods\r\n\r\n**AppRole** — Machine-to-machine authentication for services and batch jobs.\r\n\r\n```hcl\r\n# Enable AppRole\r\npath \"auth/approle/*\" {\r\n  capabilities = [\"create\", \"read\", \"update\", \"delete\", \"list\"]\r\n}\r\n\r\n# Application-specific role\r\nvault write auth/approle/role/payment-service \\\r\n  token_ttl=1h \\\r\n  token_max_ttl=4h \\\r\n  secret_id_num_uses=1 \\\r\n  secret_id_ttl=10m \\\r\n  token_policies=\"payment-service-read\"\r\n```\r\n\r\n**Kubernetes** — Pod-native authentication via service account tokens.\r\n\r\n```hcl\r\nvault write auth/kubernetes/role/api-server \\\r\n  bound_service_account_names=api-server \\\r\n  bound_service_account_namespaces=production \\\r\n  policies=api-server-secrets \\\r\n  ttl=1h\r\n```\r\n\r\n**OIDC** — Human operator access via SSO provider (Okta, Azure AD, Google Workspace).\r\n\r\n```hcl\r\nvault write auth/oidc/role/engineering \\\r\n  bound_audiences=\"vault\" \\\r\n  allowed_redirect_uris=\"https://vault.example.com/ui/vault/auth/oidc/oidc/callback\" \\\r\n  user_claim=\"email\" \\\r\n  oidc_scopes=\"openid,profile,email\" \\\r\n  policies=\"engineering-read\" \\\r\n  ttl=8h\r\n```\r\n\r\n### Secret Engines\r\n\r\n| Engine | Use Case | TTL Strategy |\r\n|--------|----------|-------------|\r\n| KV v2 | Static secrets (API keys, config) | Versioned, manual rotation |\r\n| Database | Dynamic DB credentials | 1h default, 24h max |\r\n| PKI | TLS certificates | 90d leaf certs, 5y intermediate CA |\r\n| Transit | Encryption-as-a-service | Key rotation every 90d |\r\n| SSH | Signed SSH certificates | 30m for interactive, 8h for automation |\r\n\r\n### Policy Design\r\n\r\nFollow least-privilege with path-based granularity:\r\n\r\n```hcl\r\n# payment-service-read policy\r\npath \"secret/data/production/payment/*\" {\r\n  capabilities = [\"read\"]\r\n}\r\n\r\npath \"database/creds/payment-readonly\" {\r\n  capabilities = [\"read\"]\r\n}\r\n\r\n# Deny access to admin paths explicitly\r\npath \"sys/*\" {\r\n  capabilities = [\"deny\"]\r\n}\r\n```\r\n\r\n**Policy naming convention:** `{service}-{access-level}` (e.g., `payment-service-read`, `api-gateway-admin`).\r\n\r\n---\r\n\r\n## Cloud Secret Store Integration\r\n\r\n### Comparison Matrix\r\n\r\n| Feature | AWS Secrets Manager | Azure Key Vault | GCP Secret Manager |\r\n|---------|--------------------|-----------------|--------------------|\r\n| Rotation | Built-in Lambda | Custom logic via Functions | Cloud Functions |\r\n| Versioning | Automatic | Manual or automatic | Automatic |\r\n| Encryption | AWS KMS (default or CMK) | HSM-backed | Google-managed or CMEK |\r\n| Access control | IAM policies + resource policy | RBAC + Access Policies | IAM bindings |\r\n| Cross-region | Replication supported | Geo-redundant by default | Replication supported |\r\n| Audit | CloudTrail | Azure Monitor + Diagnostic Logs | Cloud Audit Logs |\r\n| Pricing model | Per-secret + per-API call | Per-operation + per-key | Per-secret version + per-access |\r\n\r\n### When to Use Which\r\n\r\n- **AWS Secrets Manager**: RDS/Aurora credential rotation out of the box. Best when fully on AWS.\r\n- **Azure Key Vault**: Certificate management strength. Required for Azure AD integrated workloads.\r\n- **GCP Secret Manager**: Simplest API surface. Best for GKE-native workloads with Workload Identity.\r\n- **HashiCorp Vault**: Multi-cloud, dynamic secrets, PKI, transit encryption. Best for complex or hybrid environments.\r\n\r\n### SDK Access Patterns\r\n\r\n**Principle:** Always fetch secrets at startup or via sidecar — never bake into images or config files.\r\n\r\n```python\r\n# AWS Secrets Manager pattern\r\nimport boto3, json\r\n\r\ndef get_secret(secret_name, region=\"us-east-1\"):\r\n    client = boto3.client(\"secretsmanager\", region_name=region)\r\n    response = client.get_secret_value(SecretId=secret_name)\r\n    return json.loads(response[\"SecretString\"])\r\n```\r\n\r\n```python\r\n# GCP Secret Manager pattern\r\nfrom google.cloud import secretmanager\r\n\r\ndef get_secret(project_id, secret_id, version=\"latest\"):\r\n    client = secretmanager.SecretManagerServiceClient()\r\n    name = f\"projects/{project_id}/secrets/{secret_id}/versions/{version}\"\r\n    response = client.access_secret_version(request={\"name\": name})\r\n    return response.payload.data.decode(\"UTF-8\")\r\n```\r\n\r\n```python\r\n# Azure Key Vault pattern\r\nfrom azure.identity import DefaultAzureCredential\r\nfrom azure.keyvault.secrets import SecretClient\r\n\r\ndef get_secret(vault_url, secret_name):\r\n    credential = DefaultAzureCredential()\r\n    client = SecretClient(vault_url=vault_url, credential=credential)\r\n    return client.get_secret(secret_name).value\r\n```\r\n\r\n---\r\n\r\n## Secret Rotation Workflows\r\n\r\n### Rotation Strategy by Secret Type\r\n\r\n| Secret Type | Rotation Frequency | Method | Downtime Risk |\r\n|-------------|-------------------|--------|---------------|\r\n| Database passwords | 30 days | Dual-account swap | Zero (A/B rotation) |\r\n| API keys | 90 days | Generate new, deprecate old | Zero (overlap window) |\r\n| TLS certificates | 60 days before expiry | ACME or Vault PKI | Zero (graceful reload) |\r\n| SSH keys | 90 days | Vault-signed certificates | Zero (CA-based) |\r\n| Service tokens | 24 hours | Dynamic generation | Zero (short-lived) |\r\n| Encryption keys | 90 days | Key versioning (rewrap) | Zero (version coexistence) |\r\n\r\n### Database Credential Rotation (Dual-Account)\r\n\r\n1. Two database accounts exist: `app_user_a` and `app_user_b`\r\n2. Application currently uses `app_user_a`\r\n3. Rotation rotates `app_user_b` password, updates secret store\r\n4. Application switches to `app_user_b` on next credential fetch\r\n5. After grace period, `app_user_a` password is rotated\r\n6. Cycle repeats\r\n\r\n### API Key Rotation (Overlap Window)\r\n\r\n1. Generate new API key with provider\r\n2. Store new key in secret store as `current`, move old to `previous`\r\n3. Deploy applications — they read `current`\r\n4. After all instances restarted (or TTL expired), revoke `previous`\r\n5. Monitoring confirms zero usage of old key before revocation\r\n\r\n---\r\n\r\n## Dynamic Secrets\r\n\r\nDynamic secrets are generated on-demand with automatic expiration. Prefer dynamic secrets over static credentials wherever possible.\r\n\r\n### Database Dynamic Credentials (Vault)\r\n\r\n```hcl\r\n# Configure database engine\r\nvault write database/config/postgres \\\r\n  plugin_name=postgresql-database-plugin \\\r\n  connection_url=\"postgresql://{{username}}:{{password}}@db.example.com:5432/app\" \\\r\n  allowed_roles=\"app-readonly,app-readwrite\" \\\r\n  username=\"vault_admin\" \\\r\n  password=\"<admin-password>\"\r\n\r\n# Create role with TTL\r\nvault write database/roles/app-readonly \\\r\n  db_name=postgres \\\r\n  creation_statements=\"CREATE ROLE \\\"{{name}}\\\" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}'; GRANT SELECT ON ALL TABLES IN SCHEMA public TO \\\"{{name}}\\\";\" \\\r\n  default_ttl=1h \\\r\n  max_ttl=24h\r\n```\r\n\r\n### Cloud IAM Dynamic Credentials\r\n\r\nVault can generate short-lived AWS IAM credentials, Azure service principal passwords, or GCP service account keys — eliminating long-lived cloud credentials entirely.\r\n\r\n### SSH Certificate Authority\r\n\r\nReplace SSH key distribution with a Vault-signed certificate model:\r\n\r\n1. Vault acts as SSH CA\r\n2. Users/machines request signed certificates with short TTL (30 min)\r\n3. SSH servers trust the CA public key — no `authorized_keys` management\r\n4. Certificates expire automatically — no revocation needed for normal operations\r\n\r\n---\r\n\r\n## Audit Logging\r\n\r\n### What to Log\r\n\r\n| Event | Priority | Retention |\r\n|-------|----------|-----------|\r\n| Secret read access | HIGH | 1 year minimum |\r\n| Secret creation/update | HIGH | 1 year minimum |\r\n| Auth method login | MEDIUM | 90 days |\r\n| Policy changes | CRITICAL | 2 years (compliance) |\r\n| Failed access attempts | CRITICAL | 1 year |\r\n| Token creation/revocation | MEDIUM | 90 days |\r\n| Seal/unseal operations | CRITICAL | Indefinite |\r\n\r\n### Anomaly Detection Signals\r\n\r\n- Secret accessed from new IP/CIDR range\r\n- Access volume spike (>3x baseline for a path)\r\n- Off-hours access for human auth methods\r\n- Service accessing secrets outside its policy scope (denied requests)\r\n- Multiple failed auth attempts from single source\r\n- Token created with unusually long TTL\r\n\r\n### Compliance Reporting\r\n\r\nGenerate periodic reports covering:\r\n\r\n1. **Access inventory** — Which identities accessed which secrets, when\r\n2. **Rotation compliance** — Secrets overdue for rotation\r\n3. **Policy drift** — Policies modified since last review\r\n4. **Orphaned secrets** — Secrets with no recent access (>90 days)\r\n\r\nUse `audit_log_analyzer.py` to parse Vault or cloud audit logs for these signals.\r\n\r\n---\r\n\r\n## Emergency Procedures\r\n\r\n### Secret Leak Response (Immediate)\r\n\r\n**Time target: Contain within 15 minutes of detection.**\r\n\r\n1. **Identify scope** — Which secret(s) leaked, where (repo, log, error message, third party)\r\n2. **Revoke immediately** — Rotate the compromised credential at the source (provider API, Vault, cloud SM)\r\n3. **Invalidate tokens** — Revoke all Vault tokens that accessed the leaked secret\r\n4. **Audit blast radius** — Query audit logs for usage of the compromised secret in the exposure window\r\n5. **Notify stakeholders** — Security team, affected service owners, compliance (if PII/regulated data)\r\n6. **Post-mortem** — Document root cause, update controls to prevent recurrence\r\n\r\n### Vault Seal Operations\r\n\r\n**When to seal:** Active security incident affecting Vault infrastructure, suspected key compromise.\r\n\r\n**Sealing** stops all Vault operations. Use only as last resort.\r\n\r\n**Unseal procedure:**\r\n1. Gather quorum of unseal key holders (Shamir threshold)\r\n2. Or confirm auto-unseal KMS key is accessible\r\n3. Unseal via `vault operator unseal` or restart with auto-unseal\r\n4. Verify audit devices reconnected\r\n5. Check active leases and token validity\r\n\r\nSee `references/emergency_procedures.md` for complete playbooks.\r\n\r\n---\r\n\r\n## CI/CD Integration\r\n\r\n### Vault Agent Sidecar (Kubernetes)\r\n\r\nVault Agent runs alongside application pods, handles authentication and secret rendering:\r\n\r\n```yaml\r\n# Pod annotation for Vault Agent Injector\r\nannotations:\r\n  vault.hashicorp.com/agent-inject: \"true\"\r\n  vault.hashicorp.com/role: \"api-server\"\r\n  vault.hashicorp.com/agent-inject-secret-db: \"database/creds/app-readonly\"\r\n  vault.hashicorp.com/agent-inject-template-db: |\r\n    {{- with secret \"database/creds/app-readonly\" -}}\r\n    postgresql://{{ .Data.username }}:{{ .Data.password }}@db:5432/app\r\n    {{- end }}\r\n```\r\n\r\n### External Secrets Operator (Kubernetes)\r\n\r\nFor teams preferring declarative GitOps over agent sidecars:\r\n\r\n```yaml\r\napiVersion: external-secrets.io/v1beta1\r\nkind: ExternalSecret\r\nmetadata:\r\n  name: api-credentials\r\nspec:\r\n  refreshInterval: 1h\r\n  secretStoreRef:\r\n    name: vault-backend\r\n    kind: ClusterSecretStore\r\n  target:\r\n    name: api-credentials\r\n  data:\r\n    - secretKey: api-key\r\n      remoteRef:\r\n        key: secret/data/production/api\r\n        property: key\r\n```\r\n\r\n### GitHub Actions OIDC\r\n\r\nEliminate long-lived secrets in CI by using OIDC federation:\r\n\r\n```yaml\r\n- name: Authenticate to Vault\r\n  uses: hashicorp/vault-action@v2\r\n  with:\r\n    url: https://vault.example.com\r\n    method: jwt\r\n    role: github-ci\r\n    jwtGithubAudience: https://vault.example.com\r\n    secrets: |\r\n      secret/data/ci/deploy api_key | DEPLOY_API_KEY ;\r\n      secret/data/ci/deploy db_password | DB_PASSWORD\r\n```\r\n\r\n---\r\n\r\n## Anti-Patterns\r\n\r\n| Anti-Pattern | Risk | Correct Approach |\r\n|-------------|------|-----------------|\r\n| Hardcoded secrets in source code | Leak via repo, logs, error output | Fetch from secret store at runtime |\r\n| Long-lived static tokens (>30 days) | Stale credentials, no accountability | Dynamic secrets or short TTL + rotation |\r\n| Shared service accounts | No audit trail per consumer | Per-service identity with unique credentials |\r\n| No rotation policy | Compromised creds persist indefinitely | Automated rotation on schedule |\r\n| Secrets in environment variables on CI | Visible in build logs, process table | Vault Agent or OIDC-based injection |\r\n| Single unseal key holder | Bus factor of 1, recovery blocked | Shamir split (3-of-5) or auto-unseal |\r\n| No audit device configured | Zero visibility into access | Dual audit devices (file + syslog) |\r\n| Wildcard policies (`path \"*\"`) | Over-permissioned, violates least privilege | Explicit path-based policies per service |\r\n\r\n---\r\n\r\n## Tools\r\n\r\n| Script | Purpose |\r\n|--------|---------|\r\n| `vault_config_generator.py` | Generate Vault policy and auth config from application requirements |\r\n| `rotation_planner.py` | Create rotation schedule from a secret inventory file |\r\n| `audit_log_analyzer.py` | Analyze audit logs for anomalies and compliance gaps |\r\n\r\n---\r\n\r\n## Cross-References\r\n\r\n- **env-secrets-manager** — Local `.env` file hygiene, leak detection, drift awareness\r\n- **senior-secops** — Security operations, incident response, threat modeling\r\n- **ci-cd-pipeline-builder** — Pipeline design where secrets are consumed\r\n- **docker-development** — Container secret injection patterns\r\n- **helm-chart-builder** — Kubernetes secret management in Helm charts"
  user_template: ""
variables: []
install:
  steps:
    - title: Download & unzip
      detail: >-
        Download the .zip package from SkillVault and unzip it. The secrets-vault-manager/ folder
        contains SKILL.md plus any companion scripts, references and assets.
    - title: Copy into your agent skills directory
      detail: >-
        Move the folder into your agent's skills directory — e.g. ~/.claude/skills/ (Claude Code),
        .codex/skills/, .cursor/skills/ or your project's .claude/skills/ folder — then restart or
        reload the session.
    - title: Use it
      detail: >-
        Describe the task in natural language; the agent loads the skill automatically when the
        request matches the skill description.
usage:
  steps: []
metadata:
  author: SkillVault
  source: https://skillvault.top/skills/secrets-vault-manager
  exported_at: "2026-11-03T07:44:27.287Z"

安装指南

  1. 1

    Download & unzip

    Download the .zip package from SkillVault and unzip it. The secrets-vault-manager/ folder contains SKILL.md plus any companion scripts, references and assets.

  2. 2

    Copy into your agent skills directory

    Move the folder into your agent's skills directory — e.g. ~/.claude/skills/ (Claude Code), .codex/skills/, .cursor/skills/ or your project's .claude/skills/ folder — then restart or reload the session.

  3. 3

    Use it

    Describe the task in natural language; the agent loads the skill automatically when the request matches the skill description.

使用方法

平台兼容性

ChatGPT GPTs

OpenAI

将系统提示词粘贴到 GPT 的「Instructions」字段,并把用户模板作为起始消息使用。

官方文档

Claude Code

Anthropic

将导出的 .aiskill JSON 保存为项目中的技能文件,或将系统提示词粘贴进 CLAUDE.md / 斜杠命令 Markdown 文件。

官方文档

Cursor

Anysphere

将系统提示词复制到 .cursor/rules/*.mdc(或设置中的 Project Rules),并在智能体提示词中引用用户模板。

官方文档

相关技能