[codex core] Harden fake shell approval boundaries#30631
Open
bookholt-oai wants to merge 1 commit into
Open
Conversation
This was referenced Jun 30, 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.
Why
A model-selected or nested path-qualified shell could be reduced to its inner command during approval analysis. A fake shell wrapping a known-safe command such as
lscould therefore inherit the inner command's trust, including when the call requested a sandbox expansion. Approval-cache normalization and proposed durable rules also discarded the outer shell context.What
How
Unified exec now carries whether the shell was configured or model-selected into exec-policy evaluation. Model-selected path shells and nested path-qualified shell wrappers use a fail-closed origin, while explicit user-authored allow rules retain their existing precedence. Cross-platform path qualification handles Unix, Windows drive, UNC, and backslash spellings.
Testing
just test -p codex-core exec_policy— 105 passed.just test -p codex-core command_canonicalization— 6 passed.just fix -p codex-core— clean.just fmt— clean.A local all-core attempt was not used as a green signal because its harness lacked the stdio test fixture and its realtime tests timed out; the affected approval tests pass in isolation. GitHub CI remains the authoritative full-run signal.
Tracking: BUGB-17231