Bible Network Crypto DeFi Onchain RWA AI Agent Stablecoin Chain SAFU CryptoTax DeFAI AGI Claude Me Claude Skill Claude Design Claude Cowork
Independent Media
Not affiliated with any project
Learn Claude Skills. Do Everything Better.
claudeskill-me.com
LATEST
Watching Claude Code Compaction and Hooks Through OpenTelemetry: Reading the compaction, hook_execution_complete and precompute_reuse Fields  ·  Blind Spots in Bash Permission Rules: deny Misses /bin/rm, bash -c and git -C, and devbox run * Lets Any Inner Command Through  ·  CLAUDE.md Too Long? Use .claude/rules/ and paths So Rules Load Only When Claude Touches Matching Files  ·  Chromium Says No usable sandbox! Inside Claude Code's Sandbox: What --no-sandbox, excludedCommands and allowNestedUserNamespaces Each Give Up  ·  Claude Code v2.1.309 Fixes a Batch of Sandbox and Permission Gaps: Startup Files Outside the Sandbox, denyWrite Through Symlinks and More  ·  The auto mode $defaults Trap: Leave One String Out of autoMode.soft_deny and the Built-In Force-Push Rules Disappear
Glossary · Tools Integration

Permission Rules

Tools Integration intermediate

30-Second Version · For the impatient
Claude Code's allow, ask and deny rules, written as Tool or Tool(specifier), that decide before a tool runs whether to allow, prompt or refuse; they match the text of the call, not the program, so they are not a security boundary.
Full Explanation +
01 · What is this?

What are Permission Rules?

A permission rule has the form Tool or Tool(specifier) and comes in three kinds: allow, ask and deny. A bare tool name such as Bash matches every use of that tool; a specifier narrows it, for example Bash(npm run build) matches that exact command, Read(./.env) matches reading that file, and WebFetch(domain:example.com) matches fetches to that domain. Deny and ask rules can also match a top-level input parameter with Tool(param:value).

02 · Why does it exist?

Why do they exist?

They give you a middle ground between asking every time and allowing everything: routine safe commands stop prompting while dangerous ones are always refused. Rules can be checked into version control for a team, and each developer can add their own. Precedence is explicit: a deny at any scope beats allow, and managed settings are highest, so not even command-line arguments can override a managed rule.

03 · How does it affect your decisions?

How do they work, and what are the limits?

Bash rules match the command text Claude writes: * stands for any text, and a trailing space-star also matches the bare command; in compound commands (&&, ||, ;, pipes) each subcommand must match an allow rule separately, while a deny or ask rule fires if any subcommand matches; a fixed set of wrappers such as timeout, time, nice and nohup is stripped before matching. The docs say plainly that a deny or ask rule covers the invocation Claude usually produces and is not a security boundary around the program: Bash(rm *) does not stop /bin/rm or bash -c. For enforcement independent of text use the Sandbox; for custom checks use a PreToolUse hook.

04 · What should you do?

So what does this mean for me?

Treat rules as a convenience layer that reduces prompts, not a guarantee that something cannot happen. Write allow rules specific enough to include the inner command (use Bash(devbox run npm test), not Bash(devbox run *), which lets anything after devbox run through); leave what truly must not happen to the Sandbox or a hook. This "how to use it" part is my summary of the official docs.

Sources: Configure permissions - Claude Code Docs
Real-World Example +

The docs' example: allow Bash(npm run *) and Bash(git commit *) and deny Bash(git push *), so npm scripts and commits stop prompting and git push is refused; yet git -C . push is not matched by that deny.

Common Misconceptions +
✕ Misconception 1
× Misconception: denying Bash(curl *) means no network access, when actually: it does not stop /usr/bin/curl or sh -c, and limiting WebFetch does not stop Bash curl either
✕ Misconception 2
× Misconception: a PreToolUse hook returning allow can clear a denied action, when actually: matching deny and ask rules still apply; only a hook exiting with code 2 blocks before rules are evaluated
The Missing Link +
Direct Impact

Pros: fine-grained, shareable, with explicit precedence. Cons: they match text only, so alternative spellings and environment runners make a rule wider or narrower than you think.

Ask a Question
Please enter at least 10 characters
More Related Topics