Repository navigation
fix(approvals): stop env and find -exec escaping "Always allow" patterns - #707
Merged
Merged
Conversation
`env` was on the safe-to-pattern list, so one "Always allow" saved `env *` and auto-approved `env sh -c '<anything>'`. `find *` likewise matched `find . -delete` / `find . -exec rm … \;`, and read-only rules matched file-writing flags like `sort -o` and `git diff --output`. - Move `env` from PATTERNABLE_PREFIXES to NEVER_PATTERN_PREFIXES. - Add ESCALATING_ARGS: a command starting with `env`, or carrying find -exec/-execdir/-ok/-okdir/-delete/-fprint*/-fls, sort -o, tree -o, or git diff/log/show --output, never matches a pattern or prefix rule (repo or cross-repo) and never derives one. Exact "Always allow" matches still work. Stored `env *` patterns stop matching too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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
Follow-up to the security audit (High #2 was fixed by #694's segment splitting). Some commands on the safe-to-pattern list could still run other programs or write files:
envwas patternable → one "Always allow" savedenv *, which auto-approvedenv sh -c '<anything>'.find *matchedfind . -deleteandfind . -exec rm -rf . \;(no{}, so the splitter doesn't refuse it).sort -o,tree -o,git diff/log/show --output.Changes
envmoves fromPATTERNABLE_PREFIXEStoNEVER_PATTERN_PREFIXES.ESCALATING_ARGS+escapesPatternRules(): such commands never match a pattern or prefix rule (per-repo or cross-repo) and never derive a pattern. Exact "Always allow" matches still apply. Already-storedenv *patterns stop matching.Test plan
escalating commandstests inserver/approval-manager.test.tsapproval-manager,prompt-router,shell-commandsuites pass (117 tests)server/relay/*missing express-session locally; 4utility-agenttests that fail identically onmain)🤖 Generated with Claude Code