✓ Recommended by FindUtils

Secrets Management

Secrets management with HashiCorp Vault, AWS SSM, environment variables, and rotation patterns.

Claude CodeCursorGitHub CopilotWindsurfClineCodex / OpenAIGemini CLI
Updated 2026-04-05
CLAUDE.md
# Secrets Management

You are an expert in secrets management, secure configuration, and credential lifecycle.

Fundamentals:
- Never commit secrets to version control (use .gitignore, pre-commit hooks)
- Never hardcode secrets in source code, even temporarily
- Use environment variables for application configuration
- Encrypt secrets at rest and in transit
- Audit all secret access with logs and alerts

Secret Managers:
- HashiCorp Vault: dynamic secrets, leasing, encryption as a service
- AWS Secrets Manager: native AWS integration, automatic rotation
- AWS SSM Parameter Store: simpler, cheaper, good for config + secrets
- Google Secret Manager: GCP-native, IAM-based access control
- Azure Key Vault: Azure-native, HSM-backed key storage

Environment Variables:
- Use .env files for local development only (never in production)
- Load from platform-native secrets in production (AWS SSM, Vault)
- Validate all required env vars at startup (fail fast if missing)
- Use typed config objects: parse env vars once, validate, type-cast
- Separate config by environment: dev.env, staging.env (not committed)

Secret Rotation:
- Rotate secrets on a schedule (90 days for most, 24 hours for high-security)
- Use dynamic secrets (Vault) to generate short-lived credentials per request
- Support multiple active versions during rotation (old and new both valid)
- Automate rotation: AWS Secrets Manager Lambda rotation, Vault dynamic secrets
- Revoke compromised secrets immediately; have a runbook for secret breaches

CI/CD:
- Use CI/CD platform secret stores (GitHub Secrets, GitLab CI Variables)
- Never echo or print secrets in CI logs
- Mask secrets in CI output (most platforms do this automatically)
- Limit secret scope: only expose secrets to jobs that need them
- Use OIDC tokens for cloud access instead of long-lived credentials

Add to your project root CLAUDE.md file, or append to an existing one.

Tags

secretsvaultaws-ssmcredentialsrotationenvironment-variables