fix(#429): prevent API keys from being committed via map-codebase

Defense-in-depth approach:

Layer 1 - Prevention:
- Add <forbidden_files> section to gsd-codebase-mapper agent
- Explicitly prohibit reading .env, credentials, keys, secrets
- Agent can note file existence but never quote contents

Layer 2 - Detection:
- Add scan_for_secrets step before commit in map-codebase workflow
- Regex patterns catch: sk-*, ghp_*, AKIA*, xox*-*, JWTs, private keys
- Halts with alert if secrets detected, requires user confirmation

Layer 3 - Documentation:
- Add Security section to README
- Document Claude Code deny rules for sensitive files
- Recommend defense-in-depth approach

Closes #429

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Lex Christopherson
2026-02-05 12:15:56 -06:00
parent 12a06aba7a
commit f53011c9e2
3 changed files with 92 additions and 3 deletions

View File

@@ -545,6 +545,37 @@ At milestone completion, GSD offers squash merge (recommended) or merge with his
---
## Security
### Protecting Sensitive Files
GSD's codebase mapping and analysis commands read files to understand your project. **Protect files containing secrets** by adding them to Claude Code's deny list:
1. Open Claude Code settings (`.claude/settings.json` or global)
2. Add sensitive file patterns to the deny list:
```json
{
"permissions": {
"deny": [
"Read(.env)",
"Read(.env.*)",
"Read(**/secrets/*)",
"Read(**/*credential*)",
"Read(**/*.pem)",
"Read(**/*.key)"
]
}
}
```
This prevents Claude from reading these files entirely, regardless of what commands you run.
> [!IMPORTANT]
> GSD includes built-in protections against committing secrets, but defense-in-depth is best practice. Deny read access to sensitive files as a first line of defense.
---
## Troubleshooting
**Commands not found after install?**