Repository navigation
Conversation
…e act (Agent-Field#2813) A model refused `rm -rf /tmp/victim` ran `rm -r /tmp/victim` one call later and was never asked, because every rm entry in the critical table spells `rm -rf /`. criticalHit now reads the delete through CommandWords and unwrap: -r, -R, --recursive in any clustering, with or without -f, after sudo/env/timeout or as /bin/rm, quoted, or after --, aimed at an absolute path, ~, $HOME or a bare *. Relative targets stay ungraded. The person's no now tells the model it covered the action, not the spelling. permissions.md names the spellings, and a law test fails the build if the manual lists a critical command the gate does not ask about (rm -rf * was promised and never matched).
… its rule (Agent-Field#2813) TestTheMemoDoesNotAnswerForACriticalCommand pins `rm -rf /` to the rule `critical command "rm -rf /"`. Checking the recursive delete before the table reported it as "rm -rf /*" instead. The table now answers first, and only what it misses is read as a recursive delete.
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.
Closes #2813.
What was wrong
A model whose
rm -rf /tmp/victimwas refused ranrm -r /tmp/victimone call later, and it ran without asking. Everyrmentry in the critical-command table spellsrm -rf /orrm -fr /, so only that exact text was caught. The issue's probe, run ondevc4ce12c6a, graded onlyrm -rf /tmp/victimas critical.What changed
internal/approval/bash.go:criticalHitchecks for a recursive delete before it consults the text table. The newrecursiveRemoveHitreads the command through the package's existingCommandWordsandunwrap, so quotes,sudo/env/timeoutand/bin/rmare handled the way the credential floor already handles them. Anrmwith-r,-Ror--recursive(clustered, split, with or without-f, or after--) aimed at an absolute path,~,$HOME/${HOME}or a bare*is critical. Two rule names are reported, both of them spellings a person can find in the manual:rm -rf /*for a path,rm -rf *for a bare*.Unchanged: relative targets (
rm -rf build,rm -r ./build,rm -rf build/*), single-file deletes (rm /tmp/one.log),git rm -r,grep -randecho 'rm -r …'all still run under an allow without asking.find -deleteand the rest of the unbounded list stay out of scope, as the issue says.internal/session/consent.go: a person's no now continues… They said no to this action, not to this spelling: ask before doing the same thing another way.It still starts withdenied by the person: <rule>, so every reader of that prefix (the factory receipts, the existing tests) is unaffected. Only the model reads it; the person's transcript row still saysdenied.internal/manual/chat/permissions.md: names the spellings that ask and quotes the new sentence. The page already promised thatrm -rf *asks, but no table entry matched it; now it does.Tests
TestCriticalHitgains the issue's whole list as true rows, plussudo, compound-line, single-quoted, braced${HOME},~/…and second-target cases. The false rows the issue says must stay (rm -rf build,rm -rf ./tmp/x,rm -r ./build) are kept, along with new false rows for single files,rm -- -r,echo rm …andrmdir.TestEveryCriticalCommandTheManualNamesIsAskedAboutreads the manual'sa critical command (…)sentence and fails if the gate doesn't ask about one of the commands in it. It fails onrm -rf *without this change and passes with it.How it was checked
On native Windows 11:
go build ./...,go vetand gofmt pass.TestCriticalHit(49 cases), the new manual law,TestCheckCriticalCommandsand theTestAlwaysAsks*floor tests pass.TestTheChatManualAnswersTheQuestionsPeopleAskandTestExecutionNotesReceiptOutcomespass.!-command tests that read the denial wording pass when run one at a time.These fail identically on unchanged
devon Windows, so they aren't caused by this change:internal/approvalcredential tests (Windows paths)allowsubtest ofTestUserBashCriticalFloorAsksUnderAllowTestARefusedPermissionIsNeverKeptAsARuleAndTheNextTurnStillNotices, which hangsinternal/manualchecks that trip on CRLF line endingsCI's
touched packagesis the proof on Linux.e2e not run: no key, and no tmux. The issue's tmux acceptance (a deny of
rm -rf <dir>, then a second card forrm -r <dir>with the folder still there) is not covered here.