# Permission rules block

> Permission rules use ToolName(specifier) in allow and deny arrays; a bare tool name in deny disables it. Pair with OS sandboxing for subprocesses.

URL: https://bartlomiejkrupa.dev/notes/permission-rules-block/
Category: snippet | Updated: 2026-10-07
Summary: Permission rules use ToolName(specifier) in allow and deny arrays; a bare tool name in deny disables it. Pair with OS sandboxing for subprocesses.

Claude Code permission rules live in `settings.json` (also CLI flags, subagent frontmatter, hook matchers). Format: `ToolName(specifier)`. A bare tool name in `deny` removes the tool entirely.

```json
{
  "permissions": {
    "allow": ["Bash(pnpm test *)", "WebFetch(domain:docs.astro.build)"],
    "deny": ["Read(./.env*)", "Read(~/.ssh/**)", "Read(~/.aws/**)", "WebSearch"]
  }
}
```

| Rule | Applies to | Matches |
| --- | --- | --- |
| `Bash(npm run *)` | Bash, Monitor | Command patterns |
| `Read(~/secrets/**)` | Read; best-effort for Grep, Glob, and `@file` mentions | Path patterns |
| `Edit(/src/**)` | Edit, Write, NotebookEdit | Path patterns |
| `WebFetch(domain:example.com)` | WebFetch | Domains |
| `Agent(Explore)` | Agent | Subagent types |

A `Read` deny rule also blocks `Edit` and `Write` on the same path. `Read`/`Edit` deny rules cover file commands Claude Code recognizes inside Bash (`cat`, `sed`, `grep`), but not arbitrary subprocesses - a Python script that opens the file walks past them. Close that gap with the [sandbox ladder](/notes/sandbox-ladder).

Deny rules are checked before the permission mode, so a `deny` entry still blocks under `bypassPermissions`. That ordering is what makes a rule worth writing instead of prompting - see [two-way door](/notes/two-way-door) for deciding which actions earn one.

See the [read/mutate permission split](/notes/read-mutate-permission-split) for which of the 46 tools ask. Full security playbook: [Claude Code security in 2026](/articles/claude-code-security-sandboxing-2026). Tool behavior: [Claude Code tools](/articles/claude-code-tools).

Sources:
- Configure permissions: https://code.claude.com/docs/en/permissions
- Choose a permission mode: https://code.claude.com/docs/en/permission-modes
