Repository navigation
Confirm policy: refuse any history-expansion character in agent text - #4
Merged
Merged
Conversation
Under --policy confirm agent text could hold a '!' followed by a blank,
'=' or '(', where bash and zsh do not expand it. The editing input the
policy keeps (Left, Backspace, more text) turned it into a history
reference afterwards: "echo ! ", Backspace, "-2" leaves "echo !-2" on
the line, and with Space bound to magic-space (oh-my-zsh does that) the
next blank drew the command before last, one the person typed in
private mode included, on the agent's screen without any Enter. Found in
the lab VMs (Fedora 44, Ubuntu 24.04; bash and zsh).
Every '!' is now refused, like '^'; the broker cannot tell what the line
holds once it was edited. The policy_denied message tells the agent to
write -ne, test -z or a script file instead.
tests/integration/confirm_test.go (vmtest) drives real bash and zsh
sessions under --policy confirm: Tab, BTab, Up, Down, PgUp, PgDn, tabs,
'!' and '^' in text are refused; ./configure and Makefile payloads stay
untouched while the agent tries to complete them (the person's own Tab
runs them, as a control); plain text with an approved Enter runs; and
the editing sequence above no longer shows a private command.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Found in VM tests with real bash and zsh sessions: text with
!followed by a blank,=or(was allowed, and could be edited with Backspace into a history reference that a shell with Space bound to magic-space expands on screen without an Enter. Under the confirm policy agent text may no longer contain!at all (as with^); the refusal message suggests alternatives. This removes!=and! cmdfor agents in confirm sessions.Adds a VM integration test that drives bash and zsh under the confirm policy. Validated on Fedora 44 (SELinux) and Ubuntu 24.04 (AppArmor): broker and escape matrices pass with and without the guard, a genuine cotty agent reads confined (strong with the guard), and the forgeries read weak.
🤖 Generated with Claude Code