Daniel Avila
|
ceb3a9e40c
|
feat(hooks): enhance dangerous-command-blocker with multi-level security (#281)
Enhanced the dangerous-command-blocker hook with comprehensive protection:
## Features:
- **3-Level Security System:**
- Level 1: Block catastrophic commands (rm -rf /, dd, mkfs, fork bombs)
- Level 2: Protect critical paths (.claude/, .git/, node_modules/, .env, etc.)
- Level 3: Warn about suspicious patterns (wildcards, chained commands)
- **Python Script Architecture:**
- Moved from inline Python to dedicated script for better maintainability
- Script auto-installed to .claude/scripts/dangerous-command-blocker.py
- Clear regex patterns and detailed error messages
- **Protected Resources:**
- Claude Code configuration (.claude/)
- Git repository (.git/)
- Node.js dependencies (node_modules/, package.json, package-lock.json)
- Environment files (.env, .env.local, etc.)
- Language manifests (Cargo.toml, go.mod, requirements.txt, Gemfile, composer.json)
## Testing:
- 16/16 test cases passing (100%)
- Blocks catastrophic operations
- Protects critical project files
- Warns on suspicious patterns
- Allows safe operations
Co-authored-by: Claude <noreply@anthropic.com>
|
2026-01-17 23:10:35 -05:00 |
|