Skip to content

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.

Claude Code 2.1.319+ · 100% Client-Side

settings.json Permissions Builder, Auditor & Rule Tester

Pick a preset or paste your existing .claude/settings.json / settings.local.json to catch silent no-op rules and leaked secrets, then test real commands before running Claude Code.

1. Default Permission Mode

Asks before edits and shell commands; safe for everyday interactive work.

2. Hardening Flags

3a. Deny rules (highest precedence)5 rules
Read(./.env)Read(./.env.*)Read(./secrets/**)Bash(curl *)Bash(wget *)
3b. Ask rules (always prompt, even in bypass)1 rules
Bash(git push *)
3c. Allow rules (pre-approved)3 rules
Bash(git status)Bash(git diff *)Bash(git log *)

Live Rule Tester (Simulate a Tool Call)

DENIEDMatch: Read(./.env)

Shell command references a path blocked by "Read(./.env)". Claude Code enforces Read deny rules on shell commands that name the file.

Security & Syntax Audit (1)

No common syntax traps or credential leaks detectedYour rules protect .env files, avoid silent Write/Grep/Glob path no-ops, and have clean wildcard boundaries.

Generated .claude/settings.json

{
  "permissions": {
    "blockWritesOutsideWorkingDirectories": true,
    "denyInsteadOfPrompting": true,
    "allow": [
      "Bash(git status)",
      "Bash(git diff *)",
      "Bash(git log *)"
    ],
    "ask": [
      "Bash(git push *)"
    ],
    "deny": [
      "Read(./.env)",
      "Read(./.env.*)",
      "Read(./secrets/**)",
      "Bash(curl *)",
      "Bash(wget *)"
    ]
  }
}
claude

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:

PriorityLayerWhat wins
1Built-in critical-path guardDestructive commands such as rm -rf ~ or rm -rf / are refused in every mode, including bypassPermissions.
2blockWritesOutsideWorkingDirectories (2.1.314+)Refuses Write, Edit, and NotebookEdit calls targeting paths outside your working directories in every mode.
3permissions.denyAlways blocks the call. Read(...) deny rules also block shell commands (such as cat .env) that directly name the denied file.
4permissions.askForces a confirmation prompt even when an allow rule or bypassPermissions is active. Under dontAsk or denyInsteadOfPrompting, prompts convert to denials.
5permissions.allowApproves the tool call without prompting.
6permissions.defaultModeFallback behavior (default, acceptEdits, plan, dontAsk, or bypassPermissions).

Four rule-syntax traps this auditor catches automatically

  • Write(path), Grep(path), and Glob(path) are silent no-ops. Claude Code accepts path rules on those tool names without throwing a JSON error, but never matches them. Always use Read(...) for file reads and Edit(...) for file edits and writes.
  • Missing space before * in Bash(...). Bash(git diff *) matches commands starting with git diff, while Bash(git diff*) also matches git diff-index.
  • .claudeignore does not block file access. Move any secret file entries into permissions.deny as Read(./.env), Read(./.env.*), and Read(./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 into settings.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 pathScopeCommit to Git?
.claude/settings.jsonShared repository policy for every contributor and CI runYes
.claude/settings.local.jsonPersonal machine-only overrides and auto-saved approvalsNo (keep gitignored and audit periodically)
~/.claude/settings.jsonUser-wide defaults across all local repositoriesLocal 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