What problem does it solve?
Pattern guide for writing PreToolUse hooks that block secret file access, credential exfiltration, and environment variable dumps. Use when auditing token-scope-guard.sh, adding new sensitive file patterns, reviewing what secret paths are protected. Inspired by: karanb192/claude-code-hooks protect-secrets pattern (MIT).
Core Features & Use Cases
- Provides structured patterns to detect secret file access, sensitive file patterns, and exfiltration attempts across 33 file patterns, 24 Bash patterns, and 15 exfiltration patterns.
- Includes safe-file exemptions (e.g., .env.example, .env.sample, .env.template) and standard hook exit codes to differentiate allowed vs blocked actions.
- Step-by-step guidance to add new patterns, run tests, and update review dates in the hook implementation for ongoing security hardening.
Quick Start
Configure and apply PreToolUse hooks to block secret file access and environment-variable exfiltration patterns in token-scope-guard.sh.