security/dangerous-command-blocker
Blocks catastrophic shell commands such as rm -rf / and mkfs, and protects the .claude, .git and node_modules paths.
- Kind
- Hook
- Works with
- Claude Code
- Languages
- TypeScript / JavaScript, Shell
- Source
- Claude Code Templates @ 72e5f237f64d
- Path
- cli-tool/components/hooks/security/dangerous-command-blocker.json
- License
- MIT
- Jobs
- Guardrails
InstallInstall it by hand, following the source.
{
"description": "Advanced protection against dangerous shell commands with multi-level security. Blocks catastrophic operations (rm -rf /, dd, mkfs), protects critical paths (.claude/, .git/, node_modules/), and warns about suspicious patterns. Features: catastrophic command blocking, critical path protection, smart pattern detection, and detailed safety messages.",
"supportingFiles": [
{
"source": "dangerous-command-blocker.py",
"destination": ".claude/hooks/dangerous-command-blocker.py",
"executable": true
}
],
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "python3 .claude/hooks/dangerous-command-blocker.py"
}
]
}
]
}
}