Borrowing it
Nothing to install: this file belongs to TheBeardedBearSAS/claude-craft. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/TheBeardedBearSAS/claude-craft/main/.claude/settings.jsongit clone --depth 1 https://github.com/TheBeardedBearSAS/claude-craftWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/hooks/thebeardedbearsas/claude-craft/pre-tool-use)<a href="https://agentmods.dev/hooks/thebeardedbearsas/claude-craft/pre-tool-use"><img src="https://agentmods.dev/badge/hooks/thebeardedbearsas/claude-craft/pre-tool-use.svg" alt="Measured on agentmods" height="20"></a>Grade C, and why
PreToolUse scanned grade C with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the commands this hook runs, not an audit. A hook is shell that executes on your machine at the event it names, which is why every command in it is printed with what was found.
Reaches for credential fileshighPrivilege escalation
SSH keys, cloud credentials, git-credentials, .npmrc, /etc/shadow: reading these is how a config file becomes a credential leak.
"command": "FILEPATH=$(jq -r '.tool_input.file_path // empty'); if echo \"$FILEPATH\" | grep -qE '(\\.env(\\.|$)|\\.envrc|credentials|secrets?|private.*key|id_(rsa|dsa|ecdsa|ed25519)|\\.pem$|\\.p(fx|12)$|\\.key$|\\.npmrc Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
"command": "INPUT=$(jq -r '.tool_input.command // empty'); if echo \"$INPUT\" | grep -qE '(curl|wget).*\\.(sh|py|rb|pl|bat|ps1)'; then echo \"BLOCKED: Downloading executable scripts is not allowed\" >&2 && exit 2; fi; if How it starts
The opening of the file, as written. The whole thing — 35 lines — stays where its author put it; the contents beside it link to each section on GitHub.
{
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "INPUT=$(jq -r '.tool_input.command // empty'); if echo \"$INPUT\" | grep -qE '(curl|wget).*\\.(sh|py|rb|pl|bat|ps1)'; then echo \"BLOCKED: Downloading executable scripts is not allowed\" >&2 && exit 2; fi; if echo \"$INPUT\" | grep -qE '(curl|wget).*(-o|-O|>)'; then echo \"BLOCKED: Downloading files requires explicit approval\" >&2 && exit 2; fi; if printf '%s' \"$INPUT\" | grep -qE '(curl|wget)[^|;&]*\\|[[:space:]]*(sh|bash|zsh|python[0-9.]*|perl|ruby)([[:space:]]|$)'; then printf 'BLOCKED: Piping a download into a shell interpreter is not allowed\\n' >&2; exit 2; fi; exit 0"
},
{
"type": "command",
"command": "INPUT=$(jq -r '.tool_input.command // empty'); HAS_RECURSIVE=$(echo \"$INPUT\" | grep -cE 'rm[[:space:]].*(-[a-zA-Z]*r[a-zA-Z]*|--recursive)' || true); HAS_FORCE=$(echo \"$INPUT\" | grep -cE 'rm[[:space:]].*(-[a-zA-Z]*f[a-zA-Z]*|--force)' || true); if [ \"$HAS_RECURSIVE\" -gt 0 ] && [ \"$HAS_FORCE\" -gt 0 ]; then echo \"BLOCKED: Destructive rm command detected (recursive+force)\" >&2 && exit 2; fi; if echo \"$INPUT\" | grep -qE '(mkfs|dd[[:space:]]+if=|:[[:space:]]*\\(\\)[[:space:]]*\\{[[:space:]]*:|chmod[[:space:]]+-?R?[[:space:]]*777|>[[:space:]]*/dev/(sd|null))'; then echo \"BLOCKED: Dangerous system command detected\" >&2 && exit 2; fi; exit 0"
}
]
},
{
"matcher": "Edit",
"hooks": [
{
"type": "command",
"command": "FILEPATH=$(jq -r '.tool_input.file_path // empty'); if echo \"$FILEPATH\" | grep -qE '(\\.env(\\.|$)|\\.envrc|credentials|secrets?|private.*key|id_(rsa|dsa|ecdsa|ed25519)|\\.pem$|\\.p(fx|12)$|\\.key$|\\.npmrc$|\\.netrc$|kubeconfig)'; then echo \"BLOCKED: Cannot edit sensitive file: $FILEPATH\" >&2 && exit 2; fi; exit 0"
}
]
},
{
"matcher": "Write",
"hooks": [
{
"type": What else settings.json configures
This page is one entry in a file that holds 6. Installing the file brings all of them; each is measured and scanned on its own page.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 35 lines scan C b3728f0efcb8
PreToolUse is a hook published in the GitHub repository TheBeardedBearSAS/claude-craft (105 stars, last pushed 3d ago), licensed MIT. Its token cost is not measured: a hook is shell that never enters the context. A static security scan graded it C with 2 findings (reaches for credential files, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other hooks, from other repositories
SessionStart
Runs when a session starts, executing on-start.js via node. From google-gemini/gemini-cli.
PreToolUse
Runs before the agent uses a tool for Bash tool calls, running an inline shell check. From apache/superset.
PreToolUse
Runs before the agent uses a tool, executing pre-write.sh and pre-bash.sh (2 commands). From anthropics/claude-cookbooks.
PreCompact
Runs before the context is compacted for manual and auto tool calls, executing hook-handler.cjs via node (4 commands). From ruvnet/RuView.
SessionStart
Runs when a session starts on startup, clear and compact, executing run-hook.cmd. From obra/superpowers.
SessionStart
Runs when a session starts, executing hook-handler.cjs and auto-memory-hook.mjs via node (2 commands). From ruvnet/RuView.