---
title: "bypassPermissions Silently Overrides allowedTools (The Restricted-Bypass Trap)"
term: "Restricted-Bypass Trap"
description: "Pairing allowedTools with permissionMode bypassPermissions does not restrict the agent — the allow list is a no-op below the bypass step, so every tool runs without prompts except the few actions no mode auto-approves."
tags:
  - anti-pattern
  - security
  - claude
aliases:
  - restricted bypass trap
  - bypassPermissions plus allowedTools
  - allowedTools does not constrain bypass
last_reviewed: 2026-06-02
maturity: adopted
---

# bypassPermissions Silently Overrides allowedTools (The Restricted-Bypass Trap)

> Pairing `allowedTools` with `permissionMode: "bypassPermissions"` does not restrict the agent — the allow list is a no-op below the bypass step.

The intuitive composition — allowlist plus bypass-prompts equals locked-down-no-prompts — produces the most permissive runtime instead. `allowedTools` adds allow rules that pre-approve listed tools; it is not a closed set. Unlisted tools fall through to the permission mode, and `bypassPermissions` approves them. Anthropic ships an explicit warning: "Setting `allowed_tools=['Read']` alongside `permission_mode='bypassPermissions'` still approves every tool." ([Configure permissions](https://code.claude.com/docs/en/agent-sdk/permissions)).

## The anti-pattern

A team wants read-only repo audits with no prompts in CI, so they write:

```typescript
const options = {
  allowedTools: ["Read", "Grep", "Glob"],
  permissionMode: "bypassPermissions"
};
```

Their model: "those three are pre-approved; bypass means no prompts; therefore the agent can only run those three." The reality: every tool (`Bash`, `Write`, `Edit`, `WebFetch`, every MCP tool) runs without prompts, apart from the few actions no mode auto-approves (see [Prompts that survive bypass](#prompts-that-survive-bypass)), and the allow list is decorative. The same shape in CLI flags (`claude -p "..." --allowedTools Read --permission-mode bypassPermissions`) executes `Bash` without prompting. Filed as [anthropics/claude-code#12232](https://github.com/anthropics/claude-code/issues/12232) and closed as not planned — intended behavior, not a bug.

## Why it works (the documented evaluation order)

The permission pipeline is a 5-step ordered flow ([Configure permissions](https://code.claude.com/docs/en/agent-sdk/permissions)):

1. Hooks — custom code can allow, deny, or pass.
2. Deny rules — `disallowedTools` and `settings.json` deny entries; matches block in every mode, including `bypassPermissions`.
3. Permission mode — `bypassPermissions` approves; `acceptEdits` approves file ops; `dontAsk` denies; others fall through.
4. Allow rules — `allowedTools` and `settings.json` allow entries; matches approve.
5. `canUseTool` callback — interactive approval (skipped under `dontAsk`).

`bypassPermissions` resolves the call at step 3; the allow check at step 4 never runs. `disallowedTools` works under bypass because deny rules sit at step 2, above the mode. The trap is the intuition that allow lists are exhaustive — they are not.

## When this backfires (the conditions that make it dangerous)

The misconfiguration is silently permissive in exactly the contexts where operators reach for it:

- Headless CI under bypass — "don't prompt me, but limit to these tools" gives the agent every tool. If injected content reaches it ([External Artifacts as Data](external-artifacts-as-data.md)), every write tool outside the few actions no mode auto-approves runs with no consent event.
- Sub-agent dispatch under inherited bypass — "When the parent uses `bypassPermissions`, `acceptEdits`, or `auto`, all subagents inherit that mode and it cannot be overridden per subagent" ([Configure permissions](https://code.claude.com/docs/en/agent-sdk/permissions)). A `subagentPermissionMode` override was [closed as not planned](https://github.com/anthropics/claude-code/issues/20264).
- MCP server addition — a newly wired server's tools fall through to bypass automatically, so write tools the operator never reviewed are auto-approved unless the server marks them `requiresUserInteraction`.
- Security review of `allowedTools` alone — a reviewer certifies the allow list as restrictive and misses the `permissionMode` interaction; the composition ships permissive.

The composition is correct only when the environment itself is the boundary — a hermetic sandbox, ephemeral VM, or throwaway container where every tool running is acceptable by construction. There the allow list is redundant rather than misleading. See [Permission Framework Choice Outweighs Model Choice](../../security/permission-framework-over-model.md) and [Blast Radius Containment](../../security/blast-radius-containment.md) for the deterministic-allowlist alternative.

## Prompts that survive bypass

Bypass approves at step 3, but it is not a blanket yes. Claude Code "doesn't auto-approve the following in any mode, including `bypassPermissions`", and the list names tools matched by an explicit ask rule, connector tools an organization sets to `ask` (in sessions where that setting reaches Claude Code), and MCP tools marked `requiresUserInteraction` ([Choose a permission mode](https://code.claude.com/docs/en/permission-modes#actions-no-mode-auto-approves)).

The changelog records one more case that this list does not name. Claude Code 2.1.323 (November 12, 2026) "changed the tool Claude uses to finish an MCP server sign-in so that it asks you to confirm, even in bypass and auto modes; where nobody can be asked, such as in `dontAsk` mode, use `/mcp`" ([changelog 2.1.323](https://code.claude.com/docs/en/changelog#2-1-323)). The changelog line is the only source for this behavior. It gives no rationale and does not describe what the confirmation shows.

For a run with nobody to answer, the MCP docs say the sign-in has to happen first: "A `claude -p` or Agent SDK run has no `/mcp` panel, so Claude Code can't run the OAuth flow there", so complete it from an interactive session with `/mcp` or `claude mcp login <name>` ([Authenticate with remote MCP servers](https://code.claude.com/docs/en/mcp#authenticate-with-remote-mcp-servers)).

The design reading is this page's inference, not Anthropic's: a sign-in adds a credential to the session, so it belongs with the grants that no mode skips.

Unattended pipelines pay for it. Authenticate each OAuth server before the run starts.

## The two correct shapes

The docs name both explicitly:

| Goal | Shape | Why |
|------|-------|-----|
| Restrict to a small set, never prompt | `permissionMode: "dontAsk"` + `allowedTools: [...]` | Deny-by-default: listed tools approve at step 4; unlisted tools fall to step 5 where `dontAsk` denies. "For a locked-down agent, pair `allowedTools` with `permissionMode: 'dontAsk'`. Listed tools are approved; anything else is denied outright." ([Configure permissions](https://code.claude.com/docs/en/agent-sdk/permissions)) |
| Trust broadly, block a few | `permissionMode: "bypassPermissions"` + `disallowedTools: [...]` | Allow-by-default with named denies. Bare `disallowedTools: ["Bash"]` removes `Bash` from the catalog entirely; `disallowedTools: ["Bash(rm *)"]` blocks scoped patterns at step 2, above the bypass step |

Anthropic's own preference for "background safety checks without prompts" is neither — it is `permissionMode: "auto"`, a classifier-gated mode that approves or denies each call ([How we built Claude Code auto mode](https://www.anthropic.com/engineering/claude-code-auto-mode)). See [Classifier-Gated Auto Permission](../agent-design/classifier-gated-auto-permission.md).

## Example

Before — restricted-bypass trap (intent: read-only CI; reality: unrestricted):

```typescript
// Intent: "Read-only audit, no prompts in CI"
const options = {
  allowedTools: ["Read", "Grep", "Glob"],
  permissionMode: "bypassPermissions"
};
```

At evaluation step 3, `bypassPermissions` approves the call. Step 4 — where `allowedTools` would match — never runs. A `Bash(rm -rf node_modules)` call from the agent or from an injected instruction in a fetched document runs without prompts. The allow list is decorative.

After — deny-by-default, no prompts (matches the original intent):

```typescript
// Listed tools approve at step 4; unlisted tools deny at step 5
const options = {
  allowedTools: ["Read", "Grep", "Glob"],
  permissionMode: "dontAsk"
};
```

A `Bash` call is not pre-approved at step 4 and is denied at step 5. The agent runs read-only without prompts, matching the operator's intent. This is the shape the docs prescribe for "locked-down" agents.

Alternative — keep bypass, block writes explicitly:

```typescript
// Bare names remove tools from the catalog; scoped patterns block at step 2
const options = {
  permissionMode: "bypassPermissions",
  disallowedTools: ["Bash", "Write", "Edit", "MultiEdit"]
};
```

`Bash`, `Write`, `Edit`, and `MultiEdit` are removed from the tool catalog before evaluation begins. Bypass approves whatever remains, apart from the few actions no mode auto-approves. This shape suits "trust the agent broadly, deny a small named set" — a different intent from deny-by-default.

## Key Takeaways

- `allowedTools` is an additive pre-approval, not a closed set; unlisted tools fall through to the permission mode ([Configure permissions](https://code.claude.com/docs/en/agent-sdk/permissions)).
- The documented 5-step evaluation order places `bypassPermissions` (step 3) above allow rules (step 4); bypass resolves the call before the allow check runs.
- `disallowedTools` works under bypass because deny rules (step 2) evaluate above the mode; this is the correct shape for "bypass but block named tools."
- For "restrict to a small set + never prompt," pair `allowedTools` with `permissionMode: "dontAsk"` — the explicit shape named in the docs.
- The trap compounds at the sub-agent boundary: parent bypass is inherited and cannot be overridden per sub-agent ([Configure permissions](https://code.claude.com/docs/en/agent-sdk/permissions); [#20264](https://github.com/anthropics/claude-code/issues/20264)).
- From Claude Code 2.1.323, the tool that finishes an MCP sign-in asks for confirmation in bypass and auto modes; where nobody can answer, sign in through `/mcp` ([changelog 2.1.323](https://code.claude.com/docs/en/changelog#2-1-323)).

## Related

- [Permission Framework Choice Outweighs Model Choice](../../security/permission-framework-over-model.md) — the broader finding that framework type drives overeager-action rates more than model choice
- [Blast Radius Containment: Least Privilege for AI Agents](../../security/blast-radius-containment.md) — deterministic narrow allowlist as the structural alternative
- [Skill disallowed-tools Frontmatter](../../tools/claude/skill-disallowed-tools.md) — the deny-side complement to allow-lists at the skill layer
- [Prompt-Only Tool Access Control](prompt-only-tool-access-control.md) — same shape one layer up: instructions cannot enforce a closed set either
- [External Artifacts Treated as Data, Not Adversarial Input](external-artifacts-as-data.md) — why the restricted-bypass trap is dangerous in the first place
- [Permission Modes as a Defense Against a Tampered Response Path (Response-Path Control Gap)](response-path-control-gap.md) — the other way a correctly-set permission mode fails: a router on the path chooses the response the mode evaluates
- [Scoped-Looking Permission Grants](scoped-looking-permission-grants.md) — the allow list working exactly as documented and still granting arbitrary execution, one entry at a time
