Skip to content

fix(governance): rm -rf inside the agent's own workdir not destructive (v0.264.3) - #459

Merged
vikasprogrammer merged 1 commit into
mainfrom
feat/rm-workdir-safe
Jul 24, 2026
Merged

fix(governance): rm -rf inside the agent's own workdir not destructive (v0.264.3)#459
vikasprogrammer merged 1 commit into
mainfrom
feat/rm-workdir-safe

Conversation

@vikasprogrammer

Copy link
Copy Markdown
Owner

What & why

Follow-up from monitoring the fleet after the enricher fixes. A residual false positive surfaced: an agent cleaning up a dir inside its own home, by absolute path was still hard-denied:

rm -rf /home/ubuntu/tools/agent-os/data/agents/engineer/work/client-app/au-registration-support
# "clean up my broken/pruned worktree dir"

The v0.260 path-safety only whitelisted /tmp + relative paths, not the agent's own workdir subtree — so a legitimate self-cleanup via absolute path read as destructive.

Fix

isSafeDeletePath now treats a strict subpath of the agent's workdir as safe (same principle as the outsideWorkdir fact for file writes — an agent operating inside its own folder is doing its own work). Threaded the existing workdir param through rmTargetsAllSafe.

Still denied (verified): the workdir ROOT itself (wiping the whole agent home), a sibling agent's home, a .. escape out of the workdir, /etc, and any unrelated absolute/system path.

Verification

  • npm run build ✓ · npm run test:governance102/102 ✓ (4 new golden cases)
  • 9/9 against the exact fleet command + safety cases.

Monitoring context

This came out of a post-deploy fleet scan: 0 denials since the fixes went live (instapods 0/24h, instawp 40 decisions/0 deny since restart, expresstech 1/0); the pre-fix denials in-window were all known-and-fixed families. This absolute-workdir rm was the one genuinely-new FP form. One softer residual remains (a ssh 'bash -s' <<EOF heredoc whose script text mentions "suspend" trips userSuspend@approve) — left as a known limit since interpreter heredocs must be scanned for safety.

🤖 Generated with Claude Code

https://claude.ai/code/session_019zMSbnPEbqSVPGLasTKENp

…) not destructive (v0.264.3)

A post-deploy fleet scan surfaced a residual false positive: an agent cleaning a
dir inside its OWN home by absolute path — e.g.
`rm -rf /home/<u>/…/agents/<a>/work/client-app/broken` — was still flagged
destructive, because the v0.260 path-safety only whitelisted /tmp + relative
paths, not the agent's own workdir subtree.

isSafeDeletePath now treats a strict SUBPATH of the workdir as safe (mirrors the
outsideWorkdir fact used for file writes). Still denied: the workdir ROOT itself
(wiping the whole agent home), a SIBLING agent's home, a `..` escape, and any
unrelated absolute/system path. 4 new golden cases; 102/102 pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019zMSbnPEbqSVPGLasTKENp
@vikasprogrammer
vikasprogrammer merged commit 7d9abec into main Jul 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant