fix(governance): rm -rf inside the agent's own workdir not destructive (v0.264.3) - #459
Merged
Conversation
…) 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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
isSafeDeletePathnow treats a strict subpath of the agent's workdir as safe (same principle as theoutsideWorkdirfact for file writes — an agent operating inside its own folder is doing its own work). Threaded the existingworkdirparam throughrmTargetsAllSafe.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:governance→ 102/102 ✓ (4 new golden 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
rmwas the one genuinely-new FP form. One softer residual remains (assh 'bash -s' <<EOFheredoc 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