Repository navigation
feat(agents): allow cd, sed, awk, xargs, cp, and mv under the sandbox - #165
Merged
Merged
Conversation
Compound calls such as cd repo && rg foo were never rule-matched, so they reached the classifier. All six are confined by the sandbox; cd stays under the scope check and xargs under the hooks. Closes #164 Co-Authored-By: Claude Fable 5.1 <[email protected]>
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.
Summary
Claude Code matches its allow rules against every command in a call, so
cd repo && rg foo, a pipeline intosed,awk, orxargs, and plaincp/mvwere never rule-matched:cd,sed(without-nor-i),awk,xargs,cp, andmvhad no allow entry. In auto mode the classifier then decided and sometimes prompted; in every other mode the call always prompted. That is where the remainingrg/grep/jqprompts came from after #163.All six are contained by the sandbox under ADR-0034:
cd: the verification scope check still asks for a target outside the worktree and temp directories, and for a run-time target.sed,awk: writes stay inside the worktree, where Git restores tracked files;sed -iwas already allowed.xargs: the hooks already unwrap it and judge the wrapped command, soxargs git add -Ais still forbidden.cp,mv: replace the-n-only forms; the sandbox confines writes, and a glob or variable argument still asks.Closes #164
Verification
uv run --frozen pytest tests/agents: 1502 passed.ruff check,ruff format --check, and dprint are clean; lefthook pre-commit and commitlint passed.home-manager switch, in a new session:cd agents && rg -n foo libandfind . -name '*.py' | xargs grep -l fooshould run without a prompt;cp *.md backup/should ask.🤖 Generated with Claude Code