Conversation
f613814 to
4ccce99
Compare
This was referenced Feb 27, 2026
152eeb0 to
4c0d9ae
Compare
viyatb-oai
approved these changes
Feb 28, 2026
4369a27 to
72e67da
Compare
owenlin0
approved these changes
Feb 28, 2026
Collaborator
owenlin0
left a comment
There was a problem hiding this comment.
love it, it's all coming together!
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Why
#12964 added
host_executable()support tocodex-execpolicy, but the zsh-fork interception path inunix_escalation.rswas still evaluating commands with the default exact-token matcher.That meant an intercepted absolute executable such as
/usr/bin/git statuscould still miss basename rules likeprefix_rule(pattern = ["git", "status"]), even when the policy also defined a matchinghost_executable(name = "git", ...)entry.This PR adopts the new matching behavior in the zsh-fork runtime only. That keeps the rollout intentionally narrow: zsh-fork already requires explicit user opt-in, so it is a safer first caller to exercise the new
host_executable()scheme before expanding it to other execpolicy call sites.It also brings zsh-fork back in line with the current
prefix_rule()execution model. Until prefix rules can carry their own permission profiles, a matchedprefix_rule()is expected to rerun the intercepted command unsandboxed onallow, or after the user acceptsprompt, instead of merely continuing inside the inherited shell sandbox.What Changed
evaluate_intercepted_exec_policy()incore/src/tools/runtimes/shell/unix_escalation.rsto centralize execpolicy evaluation for intercepted commandscheck_multiple_with_options(...)withMatchOptions { resolve_host_executables: true }commands_for_intercepted_exec_policy()so zsh-fork policy evaluation works from intercepted(program, argv)data instead of reconstructing a synthetic command before matchingENABLE_INTERCEPTED_EXEC_POLICY_SHELL_WRAPPER_PARSING, so path-sensitive matching relies on later direct exec interception rather than shell-script parsingprefix_rule()decisions rerun intercepted commands withEscalationExecution::Unsandboxed, while unmatched-command fallback keeps the existing sandbox-preserving behaviorcore/tests/common/zsh_fork.rsso both the skill-focused and approval-focused integration suites can exercise the same runtime setupcore/src/tools/runtimes/shell/unix_escalation_tests.rsfor allowed and disallowedhost_executable()mappings and the wrapper-parsing modescore/tests/suite/approvals.rsto verify a savedprefix_rule(pattern=["touch"], decision="allow")reruns under zsh-fork outside a restrictiveWorkspaceWritesandboxStack created with Sapling. Best reviewed with ReviewStack.