fix(tools): enforce shell blocklist before permission policy check#1529
Merged
fix(tools): enforce shell blocklist before permission policy check#1529
Conversation
find_blocked_command() was in the else-branch of the PermissionPolicy check, so it never ran in normal operation (PermissionPolicy is always set when autonomy_level is configured). This silently bypassed the entire blocklist — blocked_commands, DEFAULT_BLOCKED, and allow_network=false — for all autonomy levels. Move find_blocked_command() unconditionally before the policy check so it acts as a hard security gate regardless of the attached policy. PermissionPolicy remains the UX/confirmation layer on top. Adds 3 regression tests: blocklist not bypassed by permissive policy, DEFAULT_BLOCKED not bypassed by full autonomy, confirm-commands path preserved when no policy is set. Fixes #1525
4 tasks
bug-ops
added a commit
that referenced
this pull request
Mar 13, 2026
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
find_blocked_command()was in theelsebranch of thePermissionPolicycheck inShellExecutor::execute_inner(), so it never ran in normal operation (aPermissionPolicyis always set whenautonomy_levelis configured inagent_setup.rs)blocked_commands,DEFAULT_BLOCKED, andallow_network = false— for all autonomy levels, including subshell bypass vectors ($(...), backtick,<(...))find_blocked_command()unconditionally before the policy check so it acts as a hard security gate;PermissionPolicyremains the UX/confirmation layer on topChanges
crates/zeph-tools/src/shell.rs: restructureexecute_inner()permission/blocklist logicDEFAULT_BLOCKEDnot bypassed byAutonomyLevel::Full, confirm-commands path preserved when no policy is setCHANGELOG.md: document the fix under[Unreleased]Test plan
cargo nextest run -p zeph-tools --lib— all 3 new regression tests passcargo clippy --workspace --features full -- -D warnings— 0 warningsFixes #1525