Est.

Guide

Claude Code permissions: a guide for engineering leaders

What Claude Code's permission rules and modes actually control, which file wins when two disagree, where the rules stop, and how to make one policy hold on every developer's machine.

For: Engineering managers, platform teams and security leads rolling Claude Code out beyond a few early adopters.Checked against the vendor’s documentation on

What permissions control, and what they don't

Claude Code asks before it acts. Reading files in the working directory needs no approval; running shell commands, editing files, fetching URLs and searching the web do, unless a rule or a permission mode says otherwise. Permissions are the settings that decide which of those actions run silently, which stop for a person, and which never run at all.

The rules are enforced by Claude Code itself, not by the model. Instructions in a prompt or in CLAUDE.md shape what Claude tries to do, but they don't change what it is allowed to do. For a governance program that distinction matters: a sentence in CLAUDE.md is guidance, a deny rule is a control.

Permissions are also not a sandbox. A rule matches the tool call Claude makes, such as the command text it writes, not every way a program can be reached. The sections below cover where that line falls and what to pair with rules when it matters.

Allow, ask and deny: how rules are evaluated

Every rule sits in one of three lists under permissions in a settings file:

  • Allow: Claude uses the tool without asking.
  • Ask: Claude stops and asks for confirmation each time.
  • Deny: Claude can't use the tool for matching calls.

Rules are checked in a fixed order: deny first, then ask, then allow. The first match decides, and a more specific rule doesn't beat a broader one. A deny on Bash(aws *) blocks aws s3 ls even if Bash(aws s3 ls) is in the allow list; an allow rule can't carve an exception out of a deny. The same holds between ask and allow.

A deny rule that names a whole tool, such as Bash or WebFetch, removes that tool from Claude's context entirely. A scoped deny such as Bash(rm *) leaves the tool available and blocks only the matching calls.

Developers can see every active rule, and the settings file each one comes from, with the /permissions command inside a session. When someone asks why Claude was blocked or wasn't, that is the first place to look.

Where rules live, and which file wins

Permission rules follow Claude Code's general settings precedence. From highest to lowest:

LevelWhere it livesWho owns it
Managed settingsmanaged-settings.json in a system directory, an MDM profile, or server-managed settings from the Claude admin consoleThe organization. Nothing below can override it.
Command line--settings, --allowedTools, --disallowedTools when a session startsWhoever launches the session, for that session only
Project local.claude/settings.local.json in the repositoryOne developer, in one project; kept out of git
Shared project.claude/settings.json, committed to the repositoryThe team that owns the repo, reviewed like code
User~/.claude/settings.jsonOne developer, across every project

For ordinary keys the highest level that sets a value wins. Deny rules are stricter: a tool denied at any level can't be allowed by any other. If a developer's user settings allow something and the project denies it, the deny holds, and the reverse is true too. A managed deny can't be undone with --allowedTools, while --disallowedTools can still add restrictions on top of managed policy.

Two details catch teams out. First, when a developer picks "Yes, and don't ask again" on a prompt, Claude Code saves an allow rule to .claude/settings.local.json at the repository root, so standing approvals accumulate in a file no one reviews. Second, allow rules in a committed .claude/settings.json only take effect after the developer accepts the workspace trust dialog for that folder; deny and ask rules apply regardless, because they only restrict.

Permission modes, including bypass

A permission mode sets the session's default answer to calls no rule decides. Developers switch modes with Shift+Tab in the CLI or start a session in one with --permission-mode; defaultMode in a settings file sets the starting mode.

ModeWhat it doesWhere it fits
default (shown as Manual)Prompts before most edits, shell commands and network requestsSensitive work and unfamiliar code
acceptEditsAccepts file edits and common filesystem commands inside the working directories without askingIterating on code the developer is watching
planReads and explores but doesn't edit source files until a plan is approvedScoping a change before any code moves
autoSkips routine prompts; a background classifier checks actions such as shell commands and network requests against the requestHands-off work where the model is supported and the org allows it
dontAskDenies anything that would otherwise prompt; only pre-approved tools runCI and scripted runs with an exact allowlist
bypassPermissionsSkips permission prompts, apart from a short list of actions no mode auto-approvesOnly isolated containers or VMs where Claude Code can't cause damage

The --dangerously-skip-permissions flag starts a session in bypassPermissions. In that mode Claude Code also skips prompts for writes to protected paths such as .git and .claude. Anthropic's own guidance is to use it only inside a container or VM, run as a non-root user.

Organizations can switch modes off. Setting permissions.disableBypassPermissionsMode or permissions.disableAutoMode to "disable" blocks that mode; both work from any settings file but only hold against developers when set in managed settings.

Writing rules that match what you mean

Rules take the form Tool or Tool(specifier). A bare tool name matches every use of it. The specifier depends on the tool:

RuleMatches
Bash(npm run build)That exact command
Bash(npm run *)Any npm run command, including bare npm run
Read(./.env)Reading .env in the current directory
Read(//etc/**)Reading anything under the absolute path /etc
Edit(/src/**)Edits under src/, anchored at the project root for project settings
WebFetch(domain:example.com)Fetches to example.com (add *.example.com for subdomains)
mcp__github__*Every tool from an MCP server named github
Agent(Explore)The Explore subagent

For Bash, put the * after the subcommand. Bash(git log *) allows only git log; Bash(git *) allows every git command, including git push. Claude Code understands shell operators, so allowing Bash(npm test *) doesn't approve npm test && curl …: every part of a compound command has to be allowed on its own, and a deny or ask rule applies if any part matches.

Path rules in Read and Edit use gitignore syntax, and the leading characters matter: //path is absolute, ~/path is under the home directory, /path is relative to the settings file's location, and path or ./path is relative to the current directory. A single leading slash is the most common mistake: /Users/alice/secrets is not an absolute path in a rule.

Where rules stop: sandboxing and hooks

A Bash rule matches the command text Claude writes. It doesn't match the same program reached another way:

Deny ruleStopsDoesn't stop
Bash(curl *)curl https://example.com/usr/bin/curl …, sh -c 'curl …'
Bash(rm *)rm -rf build//bin/rm -rf build/, bash -c 'rm -rf build/'
Bash(git push *)git push origin maingit -C . push origin main

Likewise, Read and Edit deny rules cover Claude's own file tools and the shell commands Claude Code can recognize, but not a script that opens files itself. Treat command rules as a way to shape the agent's normal behavior and to stop accidents, not as a security boundary.

Two mechanisms go further. Sandboxing restricts the filesystem and network access of shell commands at the operating-system level, whatever the command text. PreToolUse hooks run your own script before a tool call and can block it, force a prompt or approve it; a hook can't override a deny or ask rule. Use rules for intent, hooks for checks your rules can't express, and the sandbox for the boundary that has to hold against a prompt injection.

Enforcing one policy across the organization

Anything in user or project settings can be changed by the developer who owns the file. Policy that has to hold goes in managed settings, which Claude Code applies above every other level. There are three ways to deliver them:

  • A file on each machine: managed-settings.json at /Library/Application Support/ClaudeCode/ on macOS, /etc/claude-code/ on Linux and WSL, or C:\Program Files\ClaudeCode\ on Windows, placed by whatever tooling already manages the fleet.
  • MDM or OS policy: a macOS configuration profile or a Windows registry policy pushed through tools such as Jamf, Intune or Group Policy.
  • Server-managed settings: configured in the Claude admin console and fetched when developers sign in with the organization's account. Anthropic lists this for Claude for Teams and Enterprise plans; check the server-managed settings docs for which sessions receive them.

Managed settings also unlock allowManagedPermissionRulesOnly. With it set to true, Claude Code ignores permission rules from user, project and local settings and from --allowedTools, so the managed file becomes the only source of rules. That is the strictest posture and also the most work to maintain, since every legitimate allow has to go through whoever owns the file.

A developer can confirm what reached their machine with /status, which lists the setting sources in force.

A starting policy

Most teams land on two layers: a small managed file that holds the lines that must never move, and a committed project file that each repository's owners review like any other config. This managed file keeps secrets out of Claude's file tools, makes pushes ask, and turns bypass mode off:

{
  "permissions": {
    "deny": [
      "Read(./.env)",
      "Read(./.env.*)",
      "Read(./secrets/**)"
    ],
    "ask": [
      "Bash(git push *)"
    ],
    "disableBypassPermissionsMode": "disable"
  }
}
managed-settings.json

A repository then commits the routine commands its developers would otherwise approve by hand, so the approvals are visible in review instead of piling up in local files:

{
  "permissions": {
    "allow": [
      "Bash(npm run lint)",
      "Bash(npm run test *)",
      "Bash(git diff *)",
      "Bash(git commit *)"
    ],
    "deny": [
      "Bash(npm publish *)"
    ]
  }
}
.claude/settings.json
Adjust both files to your stack before rolling them out, and test them with /permissions in a real session. Claude Code ships often and its permission behavior changes between versions; check the permissions documentation for the version your developers run.

A review checklist

  1. Is bypass mode disabled in managed settings, and is --dangerously-skip-permissions only used in containers or VMs?
  2. Do deny rules cover the files that hold credentials (.env files, key directories, cloud config under the home directory)?
  3. Are risky commands such as pushes, deploys and package publishing in ask or deny rather than left to the mode?
  4. Does every repository commit its .claude/settings.json, and does a code owner review changes to it?
  5. Has anyone looked at the .claude/settings.local.json approvals developers have built up?
  6. Where a restriction has to hold against a prompt injection, is it enforced by the sandbox rather than a command rule?
  7. Do CI runs use dontAsk with an explicit --allowedTools list instead of a broad mode?

Sources