用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/arbazkhan971/godmode --skill secrets命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | secrets |
| description | Secrets management. Leak detection, rotation, vault setup, .env management, access auditing. |
/godmode:secrets, "manage secrets", "rotate credentials"| Secret | Source | Status |
|-----------------------|----------|---------|
| DATABASE_URL | .env | PRESENT |
| JWT_SECRET | .env | PRESENT |
| STRIPE_SECRET_KEY | hardcoded| LEAKED |
# Scan current codebase
gitleaks detect --source . --verbose
# Scan full git history
gitleaks detect --source . --log-opts="--all" --verbose
# Pattern scan for hardcoded secrets
grep -rn 'API_KEY=\|SECRET=\|PASSWORD=\|TOKEN=' \
--include="*.ts" --include="*.py" --include="*.go" \
--include="*.env" src/ 2>/dev/null
IF verified leak found:
1. REVOKE the credential immediately
2. ROTATE — generate new credential
3. REMOVE from code (use env var or vault)
4. SCRUB git history (BFG Repo-Cleaner)
5. VERIFY old credential no longer works
6. AUDIT access logs during exposure window
IF AWS infrastructure: AWS Secrets Manager
(auto-rotation, IAM integration)
IF multi-cloud or on-prem: HashiCorp Vault KV-v2
IF GCP: GCP Secret Manager (auto-replication)
IF Azure: Azure Key Vault
WHEN self-hosted: Vault with AppRole auth
# .env.example — committed (template)
DATABASE_URL=postgres://user:pass@localhost:5432/dev
JWT_SECRET=development-secret-change-in-production
STRIPE_KEY=sk_test_placeholder
# Validate .env against .env.example
diff <(grep -oP '^[A-Z_]+=?' .env.example | sort) \
<(grep -oP '^[A-Z_]+=?' .env | sort)
.ENV SAFETY CHECK:
- [x] .env in .gitignore
- [x] .env.local in .gitignore
- [x] .env.production in .gitignore
- [x] .env.example exists with placeholders
- [ ] .env was never committed to git history
| Secret Type | Rotation | Threshold |
|-------------------|----------|-------------|
| Database passwords| 30 days | OVERDUE >45d|
| API keys | 90 days | OVERDUE >120d|
| JWT signing key | 90 days | OVERDUE >120d|
| TLS certificates | 365 days | OVERDUE >400d|
| OAuth secrets | 180 days | OVERDUE >210d|
ROTATION STEPS:
1. Generate new credential
2. Store in secret manager (new version)
3. Update app (auto if vault, deploy if env)
4. Verify app works with new credential
5. Revoke old (after 24h grace period)
ACCESS CONTROL:
- Each service has own identity (AppRole/IAM)
- Services access only their own secrets
- Human access requires MFA and is logged
- Production secrets never accessed directly
- Access logs retained 90+ days
- Alerts on anomalous access patterns
# Install gitleaks pre-commit hook
cat >> .pre-commit-config.yaml << 'EOF'
repos:
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.0
hooks:
- id: gitleaks
EOF
pre-commit install
SECRETS AUDIT:
Inventoried: <N>
Managed (vault): <N>
In .env (local): <N>
LEAKED: <N>
Rotation overdue: <N>
Pre-commit hook: ACTIVE | MISSING
Verdict: SECURE | NEEDS ROTATION | LEAKS FOUND
Commit: "secrets: <N> managed, <N> leaks fixed"
ls .env .env.local .env.production 2>/dev/null
grep -q "\.env" .gitignore 2>/dev/null || echo "CRITICAL"
grep -r "vault\|aws-sdk.*secrets\|@google-cloud/secret" \
package.json pyproject.toml 2>/dev/null
Log to .godmode/secrets-audit.tsv:
timestamp\ttotal\tmanaged\tleaked\trotation_overdue\tverdict
KEEP if: verified real credential in production code
DISCARD if: false positive (placeholder, public key)
OR already remediated in previous iteration
STOP when:
- Zero verified leaks in code and git history
- Pre-commit hook installed and active
- All production secrets in vault
- User requests stop