Claude Code settings.json Permissions Generator & Rule Tester
Build a hardened .claude/settings.json for Claude Code 2.1.319+, paste an existing settings.local.json to audit for leaked tokens or silent syntax traps, and simulate real Bash commands and file paths locally in your browser.
How Claude Code evaluates permission rules (precedence order)
When Claude Code evaluates a tool call, rules are checked from strictest boundary down to default mode. Higher layers always win:
| Priority | Layer | What wins |
|---|---|---|
| 1 | Built-in critical-path guard | Destructive commands such as rm -rf ~ or rm -rf / are refused in every mode, including bypassPermissions. |
| 2 | blockWritesOutsideWorkingDirectories (2.1.314+) | Refuses Write, Edit, and NotebookEdit calls targeting paths outside your working directories in every mode. |
| 3 | permissions.deny | Always blocks the call. Read(...) deny rules also block shell commands (such as cat .env) that directly name the denied file. |
| 4 | permissions.ask | Forces a confirmation prompt even when an allow rule or bypassPermissions is active. Under dontAsk or denyInsteadOfPrompting, prompts convert to denials. |
| 5 | permissions.allow | Approves the tool call without prompting. |
| 6 | permissions.defaultMode | Fallback behavior (default, acceptEdits, plan, dontAsk, or bypassPermissions). |
Four rule-syntax traps this auditor catches automatically
Write(path),Grep(path), andGlob(path)are silent no-ops. Claude Code accepts path rules on those tool names without throwing a JSON error, but never matches them. Always useRead(...)for file reads andEdit(...)for file edits and writes.- Missing space before
*inBash(...).Bash(git diff *)matches commands starting withgit diff, whileBash(git diff*)also matchesgit diff-index. .claudeignoredoes not block file access. Move any secret file entries intopermissions.denyasRead(./.env),Read(./.env.*), andRead(./secrets/**).- Leaked secrets in
.claude/settings.local.json. Clicking "Yes, and don't ask again" on a shell command that includes a database URL, bearer token, or API key saves that literal string intosettings.local.json. Paste your local settings file into Paste & Audit JSON above — everything runs locally in your browser with zero network uploads.
Where to save your generated settings.json
| File path | Scope | Commit to Git? |
|---|---|---|
.claude/settings.json | Shared repository policy for every contributor and CI run | Yes |
.claude/settings.local.json | Personal machine-only overrides and auto-saved approvals | No (keep gitignored and audit periodically) |
~/.claude/settings.json | User-wide defaults across all local repositories | Local home directory |
For a full walkthrough of the Claude Code 2.1.319 security incidents, SSH extension checks, and the local audit script, read our tested Claude Code Permissions Hardening Guide.
A note for Jupyter and data science workflows
If you are tightening Claude Code permissions because you want to run exploratory data analysis or debug notebooks without granting broad shell access, a notebook-native agent avoids most terminal permission friction altogether. RunCell (opens in a new tab) runs directly inside JupyterLab with live visibility into DataFrames, variables, and cell outputs—so you do not need bypassPermissions just to iterate on plots and pipelines.
FAQ
Does anything I paste into this tool leave my browser?
No. Rule evaluation, secret pattern auditing, and JSON generation run 100% client-side in your browser. Nothing is uploaded or stored on a server.
Why did my Write(docs/**) deny rule not block Claude Code?
Claude Code only enforces path patterns on Read(...) and Edit(...). Rules written as Write(...), Grep(...), or Glob(...) with a path specifier are accepted syntactically but ignored during matching.
Can permissions.deny stop Claude Code in bypassPermissions mode?
Yes. Explicit deny rules, explicit ask rules, and blockWritesOutsideWorkingDirectories: true all stay enforced even when bypassPermissions is active. To forbid bypass mode entirely in a repository, set "disableBypassPermissionsMode": "disable".
What is the difference between dontAsk and denyInsteadOfPrompting?
--permission-mode dontAsk is a permission mode designed for locked-down CI runs where every call that would prompt is denied immediately. "denyInsteadOfPrompting": true (added in Claude Code 2.1.319) applies the same non-hanging behavior to interactive terminal sessions, subagents, and teammates.
How do I prevent Claude Code from reading .env files?
Add "Read(./.env)" and "Read(./.env.*)" to permissions.deny. Do not rely on .claudeignore, which has no effect on tool permissions.
Related Guides
- Claude Code Permissions Hardening (2.1.319 Tested Guide)
- Claude Code Bypass Permissions: Desktop Toggle, CLI Flags, and Error Fixes
- Claude Code Mods Tutorial: Guardrails Before Shell Execution
- Claude Code Reads AGENTS.md Now: Setup & Migration Guide
- Best Agent Skills: 10 Skill Repos Compared and Audited