Claude Code Tightens Bash, Sandbox, Worktree, PowerShell and Auto Mode Permission Checks in 2.1.326

Claude CodeView original changelog

Claude Code 2.1.326 ships a large batch of permission and isolation changes. More Bash and PowerShell commands now ask first or are refused, the sandbox writes to fewer home folders, and subagents in worktrees can no longer rewrite branches shared with the main checkout. Auto mode also ignores some wildcard allow rules that previously let commands skip its safety check.

Key Takeaways

  • More Bash and PowerShell commands now ask first, or are refused where nobody can answer, including some cp/mv and environment-variable lines.
  • Sandboxed commands write to fewer home folders by default, with sandbox.filesystem.allowWrite available to re-allow specific ones.
  • Worktree-isolated subagents can no longer rewrite shared branches, closing a path from an isolated session into the main checkout.
  • Auto mode ignores some wildcard allow rules, so its safety check decides commands that earlier skipped it.
  • Sign-in files are now protected: file tools refuse writes to .credentials.json and Bash asks before commands that reach them.
  • Unattended pipelines may see new refusals, so teams should rerun automations and add explicit allow rules.

What changed

Claude Code 2.1.326 closes a wide set of gaps in the boundary between what the agent may do and what the user authorized. Individually the entries are terse, but together they change what prompts users will see and which commands now run unattended.

Bash and PowerShell permission checks

Bash permission checks now ask first, or refuse where no one can answer, for more commands. This includes some cp and mv commands, some lines that set environment variables when auto-allow is off, and commands with very long values that the checker cannot finish analyzing. Where a deny rule may apply, those long-value commands are refused outright. Commands that reach Claude Code's sign-in files now ask, and the file tools refuse writes to sign-in files such as .credentials.json. Some file tools also refuse certain device and process files.

The PowerShell tool received the same treatment. It asks before more commands, and unattended runs refuse them unless an allow rule, auto mode or bypass permissions mode allows them. Some commands now ask even in bypass permissions mode, and some are refused. Malformed PowerShell commands are denied, and commands that define a function named like a built-in command are refused so Claude can rename it.

Sandbox changes

On macOS, Linux and WSL, sandboxed commands no longer write to some sensitive home folders by default. Some can be re-allowed through sandbox.filesystem.allowWrite in user or managed settings. The sandbox also sets aside unexpected entries in a repository's .git folder after a command runs, keeps its state in some cases until /sandbox or /cd is run, and on Linux and WSL creates some missing --add-dir folders before each sandboxed command. Edits in a session's mods folder now ask more often. Commands that a permission hook or SDK host rewrites while approving stay in the sandbox if the original was checked as sandboxed, and the approver can add dangerouslyDisableSandbox: true. claude mcp serve now ignores sandbox.excludedCommands, and /rewind leaves some files untouched and reports them as skipped when the sandbox is on.

Worktree isolation

Subagents isolated in a worktree now refuse, in any repository, some git commands in Bash that can rewrite branches shared with the main checkout. ExitWorktree refuses to remove a worktree while a background subagent or shell command may still be running in it, unless Claude passes discard_changes.

Auto mode and bypass mode

Auto mode now stops some shell commands that previously ran, and ignores some wildcard shell allow rules, such as ones that name no program or start with $HOME, so the safety check decides those commands. Wildcard rules whose program is a Windows backslash path are now judged by auto mode and can be blocked, while exact rules keep their allow. Anthropic notes it plans to restore rules that start with .\. Some tool calls in bypass permissions mode now ask for approval or are denied where no one can be asked. A hook's "decision": "block" now holds in more cases, so a hook that always prints one may start blocking calls.

What users should do

Teams relying on wildcard allow rules, unattended runs or sandbox write access to home folders should rerun their workflows and add explicit rules where new prompts or refusals appear.