Developer tools

A deny rule is not a sandbox

Every coding agent demo ends the same way: let it run, let it clean up after itself while you get coffee. This autumn, a cluster of public bug reports shows what that looks like when cleanup goes wrong. Not because the…

Every coding agent demo ends the same way: let it run, let it clean up after itself while you get coffee. This autumn, a cluster of public bug reports shows what that looks like when cleanup goes wrong. Not because the model decided to wipe a drive, but because the command did exactly what the shell said, and the guard meant to catch it matched a string instead of a target.

The reports span early September to November 14, 2026, across Claude Code, Codex, Antigravity and opencode. A ten-case round-up published November 14 was still circulating on November 18 and 19.

What the commands actually said

Issue #95426, filed September 18. Claude Code on Windows with Git Bash, cleaning "stale test state" nobody asked for:

rm -rf "$(cygpath -u 'C:\')" 2>/dev/null

cygpath -u 'C:\' returns /c/, the whole drive. The value is not empty, so no quoting trick saves you. stderr went to /dev/null, hiding the permission errors that would have announced the mistake. The reporter lost roughly 600 GB over about 35 minutes.

Issue #109735, filed November 14. A subagent on Windows wanted a Linux copy of a project:

wsl -d Ubuntu-24.04 -- bash -lc 'set -u; R=~/some-dir; ... rsync -a --delete /mnt/d/<project>/ $R/'

set -u is inside the inner bash. The command line passed through wsl.exe, which interpreted it once more before the inner shell started, and in that outer shell R was undefined. $R/ became /, so the command that ran was rsync -a --delete /mnt/d/<project>/ /. Files deleted through WSL skip the Recycle Bin. When the coordinator stopped the subtask, wsl.exe exited but rsync ran inside WSL for about two more minutes. The subagent's first damage report was wrong, because rsync does not log successful deletions.

The rest follow the same shape with different spelling. In opencode #62825, a PowerShell cleanup assigned to $home, the read-only automatic variable $HOME. The assignment failed without stopping the script, Split-Path $home returned C:\Users, and Remove-Item -Recurse -Force deleted it. In a widely shared November 7 r/ClaudeCode post, xargs -n1 dirname split a path at the space in Application Support, so the parent handed to rm -rf was ~/Library. In #107274, an rm -rf removed .git and more than twelve months of unpushed history.

The intent was narrow every time

None of those commands looks like a plan to destroy a machine. They look like cleanup: a temp folder, a build directory, a browser profile, an old worktree. The damage came from where the target landed.

Four things repeat. The destructive step was something the agent added on its own. Error-hiding flags suppressed the first evidence that a delete had gone wide. Commands were reinterpreted as they crossed PowerShell, cmd, Git Bash and WSL. Nobody resolved the computed path. Seven of the ten cases in the round-up were on Windows.

The guard was there, and it was a string match

Most terminal agents gate shell commands with allow, ask and deny lists. The deny list carries the weight. A June 2026 paper from Ohio State, "One Goal, Many Commands" (arXiv:2606.15549), tested that assumption at scale.

The authors built ShellSieve, a pipeline that proposes bypass commands and validates them in a sandbox by their side effects, then ran it against 1,709 real-world denylists from GitHub, 13,332 rules in total. Between 69.0% and 98.6% failed to fully block the operation they were written for. Delete was the least bad category at 69.0%. Copy sat at 95.1%, permission changes at 97.8% and 98.6%.

The fix burden is the part that matters for a team. Fully blocking delete took an average of 54 additional commands. The paper's conclusion is blunt: the deny list is the load-bearing component, and it cannot carry the load.

You can watch the same dynamic in the vendor changelog. Claude Code 2.1.296, published October 9, fixed rm -rf /c/Users/<name> in Git Bash not asking in bypass mode, the #95426 shape. 2.1.299, October 14, fixed rm -r of a mounted drive or top-level folder (/Volumes, /media, WSL's /mnt/c) not getting the safety prompt, the #109735 shape. Later in October, v2.1.311 added CLAUDE_CODE_EVEN_MORE_DANGEROUSLY_SKIP_PERMISSIONS, an environment variable that removes the remaining block on rm, per The Register's October 27 report. Each release closes one spelling. None closes the class.

Approval prompts do not fix this

The obvious objection: a human should have approved it. In several cases a human did. The #95426 reporter pointed out that the prompt shows $(cygpath -u 'C:\'), not the result /c/. The Antigravity user in the round-up read the command, judged it narrow, and approved it. Hooks that read command text share the blind spot: they cannot see paths computed at run time or commands inside a script the agent just wrote. Agent instruction files are suggestions, not checks. #109627 told the agent not to kill gcloud, and it killed gcloud plus 65 other things.

Anthropic's sandbox documentation makes the boundary question concrete. The Bash sandbox is enforced by the OS, limits writes to the working directory and a temp directory by default, and is off by default. It runs on macOS, Linux and WSL2. On native Windows, Claude Code runs commands unsandboxed.

What actually holds

Move the boundary off the command string. A VM, a container, a separate low-privilege account or the built-in sandbox limits blast radius regardless of where a computation points. If a host drive is mounted writable inside that boundary, as /mnt/d was in #109735, the drive is not isolated.

Make empty values fail before the command runs. rm -rf "${D:?}/build" stops the shell in every layer when D is unset, and the fixed subfolder keeps a wrong value from taking the parent. Print computed paths and refuse roots and $HOME.

Use the scoped tool instead of the general one: git worktree remove before rm -rf, git clean -n before git clean -fdx, no --force until you have looked at what is left. When an agent creates temp state, record those exact paths and delete those, rather than computing a parent later.

Keep a copy outside the working tree: a push, git bundle, Time Machine. In the r/ClaudeCode case the user had no backup and later recovered most data; in codex #42355 the API keys came back from a separate backup.

Checklist for this week

  • Run one deliberately bad cleanup command against your agent setup and confirm what blocks it.
  • Check whether your agent runs sandboxed on each OS your team uses. Native Windows is the gap.
  • Replace $VAR in any delete path with ${VAR:?} plus a fixed subfolder.
  • Remove 2>/dev/null and -ErrorAction SilentlyContinue from anything that deletes or syncs with --delete.
  • Confirm the last backup of an unpushed branch sits outside the repository.
  • Keep a written list of paths the agent may delete.
  • Treat approval prompts as a speed bump, not a boundary, when the command contains $(...).

Unverified claims and gaps

  • Incident reports are user-filed GitHub issues and Reddit posts. Commands are quoted from those sources; damage figures such as 600 GB are self-reported and not independently audited.
  • The CLAUDE_CODE_EVEN_MORE_DANGEROUSLY_SKIP_PERMISSIONS change is not in the public changelog. The Register's October 27 report and the staff statement quoted there are the public record I could verify.
  • ShellSieve's bypass candidates are LLM-generated, and the paper acknowledges that an LLM recalls only a subset of possible bypasses.
  • "Seven of ten on Windows" is the round-up author's count, not a controlled sample.
  • I did not reproduce any of these commands myself.

Sources

  1. "One Goal, Many Commands: Characterizing Denylist Fragility in AI Agents," Chen and Lin, Ohio State University, arXiv:2606.15549v2, June 20, 2026. https://arxiv.org/abs/2606.15549
  2. "[Data loss] Subagent ran rsync -a --delete with an empty destination variable via wsl.exe," anthropics/claude-code issue #109735, November 14, 2026. https://github.com/anthropics/claude-code/issues/109735
  3. "[Bug] Claude Code rm -rf deleted git history (12+ months lost)," anthropics/claude-code issue #107274, November 4, 2026. https://github.com/anthropics/claude-code/issues/107274
  4. "Claude Code deleted ~600GB: unprompted rm -rf on a substitution that resolved to a drive root," anthropics/claude-code issue #95426, September 18, 2026. https://github.com/anthropics/claude-code/issues/95426
  5. "PowerShell tool allows silent recursive deletion of protected roots (C:\Users, \C:\Users\tmoam) without confirmation," anomalyco/opencode issue #62825, November 9, 2026. https://github.com/anomalyco/opencode/issues/62825
  6. "Ten coding-agent deletions, traced to the shell command that ran," Myeongseok Kang, DEV Community, November 14, 2026. https://dev.to/dooly6276/ten-coding-agent-deletions-traced-to-the-shell-command-that-ran-25jf
  7. Claude Code release v2.1.296, October 9, 2026. https://github.com/anthropics/claude-code/releases/tag/v2.1.296
  8. Claude Code release v2.1.299, October 14, 2026. https://github.com/anthropics/claude-code/releases/tag/v2.1.299
  9. "Anthropic now lets Claude users jump out of plane without parachute," The Register, October 27, 2026. https://www.theregister.com/ai-and-ml/2026/10/27/anthropic-now-lets-claude-users-jump-out-of-plane-without-parachute/5305807
  10. "Configure the sandboxed Bash tool," Anthropic Claude Code documentation, accessed November 20, 2026. https://code.claude.com/docs/en/sandboxing
Next essay

AI Made Memory Bugs Cheap. Your Patch Window Is Now the Only Defense

7 min read