Back to Blog
Hamza Farooq/December 1, 2026/6 min read

Claude Code permissions: how allow, ask and deny rules work and what admins can lock

Claude Code permissions: how allow, ask and deny rules work and what admins can lock

Claude Code checks permission rules in a fixed order: deny, then ask, then allow. The first match in that order determines the outcome, and the permissions docs say rule specificity does not change the order. Administrators can lock policy in managed settings, where allowManagedPermissionRulesOnly makes managed settings the only source of permission rules, per the settings reference.

TL;DR: Claude Code evaluates permission rules deny first, then ask, then allow, and the first match decides, however specific a rule is. A deny at any settings level cannot be overridden by an allow at another. Admins lock policy in managed settings: allowManagedPermissionRulesOnly, allowManagedHooksOnly and allowManagedMcpServersOnly are managed-only keys, while disableBypassPermissionsMode works from any file.

Key Takeaways

  • Order is fixed: deny rules are evaluated before ask rules, and ask rules before allow rules.
  • Specificity loses: a broad deny such as Bash(aws *) blocks a call that a narrower allow rule like Bash(aws s3 ls) would match.
  • Deny wins across files: rules from all levels are combined, and a deny anywhere beats an allow elsewhere.
  • Bash rules are not a boundary: a Bash(curl *) deny does not stop /usr/bin/curl or sh -c forms.
  • Managed-only keys exist: three allowManaged keys, for rules, hooks and MCP servers, are read only from a managed source.

In what order does Claude Code evaluate allow, ask and deny rules?

Claude Code evaluates rules deny, then ask, then allow, and the permissions docs state that the first match determines the outcome. Allow rules let a tool run without manual approval, ask rules prompt for confirmation, and deny rules prevent use of the tool.

A broad deny rule like Bash(aws *) blocks every matching call, including calls that also match a narrower allow rule like Bash(aws s3 ls). The same precedence applies between ask and allow, so a matching ask rule prompts even when a more specific allow rule also matches.

A bare tool name such as Bash in a deny rule removes the tool from Claude's context entirely, while a scoped rule such as Bash(rm *) leaves the tool available and blocks matching calls. The docs add that Claude Code enforces these rules, not the model, so CLAUDE.md instructions do not change them.

What do the rule syntax and wildcards match?

A rule has the form Tool or Tool(specifier), and the permissions docs give Bash(npm run build) and Read(./.env) as examples. A Bash rule with no * matches one exact command.

A trailing * with a space before it also matches the bare command, so Bash(ls *) matches ls but not lsof. The docs say to put the * after the subcommand: Bash(git log *) allows only git log commands, while Bash(git *) allows every git command.

Compound commands are split on separators such as &&, ||, ; and |. Every subcommand must be allowed for the command to run without a prompt, and a deny or ask rule applies when any subcommand matches.

File rules use gitignore pattern syntax. Per the docs, //path is an absolute path and /path is relative to the settings source, so a Read(/secrets/**) deny in user settings points at ~/.claude/secrets/**, not a project folder.

The docs warn that a Bash deny rule is not a security boundary. Bash(curl *) stops curl <url> but not /usr/bin/curl <url> or sh -c 'curl <url>'. For enforcement that ignores command text, the docs point to sandboxing and PreToolUse hooks.

Diagram of three Bash deny-rule gaps: curl by full path, sh -c wrapper, git with -C option, each shown as not matched by the plain rule

How do rules from different settings files combine?

Claude Code combines permission rules from every settings level and from command line arguments, and the permissions docs say that if a tool is denied at any level, no other level can allow it. A user-level deny blocks a project-level allow, and the reverse holds too.

The settings docs rank conflicting keys, highest first: managed settings, command line, project local, shared project, then user. The same page says lists such as permissions.allow merge instead of overriding.

PreToolUse hooks do not change the deny-first order: the permissions docs say a matching deny rule blocks the call, and a matching ask rule still prompts even when a hook returned "allow".

Which permission settings can an admin lock in managed settings?

Managed settings apply above every other level, so the managed settings docs say no user, project, local or --settings value overrides them, apart from a few security-sensitive exceptions where a stricter lower-level value still counts. Delivery routes include server-managed settings, MDM policy and a managed-settings.json file.

The docs say Claude Code reads certain keys only from a managed source, so placing them in user or project files has no effect. Other keys are accepted from any file.

KeyWhat the docs say it doesWho can set itSource
permissions.allow, ask, denyApprove, prompt for, or block listed tool usesAny fileSettings reference
permissions.disableBypassPermissionsModePrevents entering bypassPermissions mode and rejects --dangerously-skip-permissionsAny file, typically managedSettings reference
disableAutoModeRemoves auto mode from the Shift+Tab cycleAny file, most useful managedSettings reference
allowManagedPermissionRulesOnlyManaged settings become the only source of permission rulesManagedManaged settings
allowManagedHooksOnlyRestricts hooks to those your organization deploys, plus SDK hooks and hooks from plugins managed settings force-enableManagedSettings reference
allowManagedMcpServersOnlyReads allowedMcpServers from managed settings alone; deniedMcpServers still merges from every scopeManagedManaged settings

With allowManagedPermissionRulesOnly on, Claude Code ignores allow, ask and deny rules in user, project, local and --settings files, ignores --allowedTools, and stops saving new rules. Command-line --disallowedTools rules and the current session's deny and ask rules still apply, since they only restrict.

The managed settings docs note that developers can add entries to lists such as permissions.allow, so they say to deploy the list's allowManaged*Only key where one exists, and to move the deny and ask rules you rely on into managed settings.

Diagram contrasting managed-only keys (allowManagedPermissionRulesOnly, allowManagedHooksOnly, allowManagedMcpServersOnly) with any-file keys (disableBypassPermissionsMode, disableAutoMode)

My suggestion: set the three allowManaged keys together with your deny rules, then run /status on one machine to confirm the managed source loaded before rolling out. I did not test any of these behaviors myself; they are as the docs state them.

Frequently Asked Questions

Does a more specific allow rule override a deny rule in Claude Code?

No. The permissions docs say an allow rule cannot carve an exception out of a deny rule. Rules are checked deny, then ask, then allow, and specificity does not change that order.

Can a developer override an admin's deny rule?

The docs say a managed deny cannot be overridden by --allowedTools, and a deny at any level cannot be allowed by another. A developer can still add allow entries to lists unless the admin sets the matching allowManaged key.

Does a Read deny rule stop Claude reading a file through Bash?

Not always. The docs say Read and Edit deny rules apply to built-in file tools and to Bash commands Claude Code can analyze, such as cat and sed, but not to a Python or Node script that opens files itself. For OS-level enforcement the docs suggest enabling the sandbox.

Conclusion

The docs give one evaluation order, deny then ask then allow, and one cross-file rule: a deny at any level stands. For an organization, the allowManaged keys decide whether developers can add their own rules, hooks and MCP servers. My suggestion: treat deny rules as policy and pair them with sandboxing, since the docs say a Bash deny rule is not a security boundary.


Learn from me

Claude Code in Practice

Claude Code in Practice, my Maven cohort. Master Claude Code from fundamentals to advanced orchestration: skills, subagents, hooks, MCP, and production automation. Join the next cohort →

Hire us

Traversaal.ai. We're a team of forward deployed engineers solving the toughest AI problems for Fortune 100 companies: document intelligence, agentic data platforms, and real-time web intelligence, deployed in production. Work with our team to deploy your next agentic ecosystem. Talk to Traversaal.ai →

Join us

Want to solve these problems with us? We're always looking for forward deployed engineers who want to ship production AI. jobs@traversaal.ai

Hamza Farooq
Hamza Farooq

Former Senior Research Manager at Google and Walmart Labs, leading teams in optimization, NLP, recommender systems, and time series forecasting.