Claude PreToolUse (6) & SessionStart (1) Shell Wrappers
Six PreToolUse shell wrappers inspect writes, git commands, and sensitive reads offline before execution; passing calls exit 0 silently so interactive host permission prompts stay intact.
See Hook Payload Contracts ↗✅ Supported Capabilities
- forbid-content.sh (Write|Edit|NotebookEdit, 120s) and forbid-commit/push.sh (Bash(git *), 120s) enforce R1–R7 offline via check.py
- forbid-read-secret.sh (Bash, 30s) and forbid-read-path.sh (Read|Grep, 30s) canonicalize paths via realpath to defeat ../ and symlink traversal
- forbid-tamper.sh (Bash, 30s) blocks edits to core.hooksPath, disableAllHooks, and guard files; unparseable stdin fails closed with exit 2
- SessionStart runs refresh-private.py (120s) so cloud sessions hydrate dynamic lists once runtime environment variables become available
⛔ Explicit Limits / Non-Goals
- Wrappers never pass --net: a hook killed on network timeout turns into "no decision" in Claude Code; expired cache intentionally denies as error
- Glob tool calls (filenames only, no file contents) are intentionally out of scope
- Local shell checks cannot stop a privileged local user intentionally tampering outside Claude; mandatory remote rulesets and Git hooks remain the hard gate
Inputs, Environment Variables & Policy Limits
tool_input.file_path / path / contentstdinJSON (Claude Hook Payload)RequiredStandard hook payload on stdin; parse errors emit deny JSON and exit 2.
forbid-commit.sh / forbid-push.shconfigif: "Bash(git *)" · 120s timeoutRequiredBlocks --no-verify, --no-gpg-sign, agent branch pushes, and leaked commit payloads.
forbid-tamper.shconfigmatcher: "Bash" · 30s timeoutOptionalOptional WARN-level item in doctor.py; keep enabled in production setups.