Repository navigation
fix(evals): let run-validity downgrade a Bash denial on a path outside the plugin - #9517
Conversation
A denied Bash call carries no path key, so inside() saw None and every with-arm Bash denial made the run INVALID, even one reading /proc that scored the same as the denial-free runs. Take the command's rooted arguments with shlex; treat the call as inside when one is under or above a plugin root, or when it has none or does not parse. Closes #9472 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…the cap Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d line cap Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review of #9517 showed a literal rooted path outside the plugin could decide the verdict while another word named the plugin in a form the check could not read ($CLAUDE_PLUGIN_ROOT, ~, a glob, a relative path after cd, a quoted or redirected path). Split words at quotes and shell operators, and add an unknown path, counted as inside, for any word the shell would expand, a relative path with a slash, a backslash or cd. A path holding a NUL byte now counts as inside instead of crashing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Round-2 review of #9517 found PATH=/a:/plugin, /a,/plugin, a bare .., a cd inside parentheses, and /proc/self or /dev/fd paths (which resolve against the validator's own process) still read as outside the plugin. Count each as an unknown path. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
claude-review reviewed Incremental review of 48e1957 (changes since 0aeea89): no findings. I read What the change does
Fail-open check Closing issue #9472
Manifest items Known trade-off, not a finding Nothing here adds model spend or touches a trust-gated path, so there is no hold. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0aeea89dec
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
claude-security-review reviewed No security issues in the incremental change since 0aeea89. I read The change tightens the fail-closed behaviour of
I looked for ways to get a denial on a plugin file downgraded to a warning:
This is an eval-validity heuristic, not an authorization boundary, and the remaining gaps are heuristic edge cases without a concrete exploit path. The change adds no secrets, token handling, network surface, injection sink or Actions workflow change. The PR context holds no embedded instructions. manifest: not hit. No critical-findings: 0 |
…rmalized self paths Review threads on #9517: cat SKILL.md /proc/version and ls /proc . read as outside the plugin, because a relative word with no slash resolves against an unknown cwd that may be the plugin. Any word after the command word that is neither rooted nor a flag now adds an unknown path. The /proc/self, /proc/thread-self and /dev/fd screen now runs on the normalized path, so /proc//self and /./proc/self are caught. The backslash, .. and cd checks the new rule covers are dropped. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes #9472
Summary
run-validity.pycould never downgrade a with-arm Bash permission denial to a warning. A Bash call carriescommand, not a path key, soinside(None, roots)returned True and every with-arm Bash denial made the run INVALID, even a read of/procin a run that scored the same as the denial-free runs.Fix
bash_paths(command):shlex.splitthe command, split each word again at quotes, redirects, pipes, parentheses and=(so--file=/x,>/xandpython3 -c "open('/x')"count), and keep the rooted values.$, backtick, glob, leading~), any word after the command word that is neither rooted nor a flag (it resolves against an unknown cwd, socat SKILL.md /proc/versionandgrep foo /proc/xboth stay INVALID), a relative path with a slash, a path packed after another character (/a:/b,/a,/b), or a/proc/self,/proc/thread-selfor/dev/fdpath afternormpath(they resolve against the validator's own process).inside()treats a path holding a NUL byte as inside instead of crashing inrealpath.file_path/pathinput.evals(patch).Verification
test_run_validity.py: a Bashcat /proc/sys/kernel/yama/ptrace_scopedenial scoring the same is a WARN with a VALID verdict (fails onmain). Bash denials naming a plugin path (direct, ancestor,--file=,>, quoted inpython3 -c) stay INVALID; so do no-rooted-path commands, an unparseable command, every unresolvable shape listed above, and a NUL-byte path (which crashed before). The INVALID cases other than the NUL one pass onmainby design, since today every Bash denial is INVALID; they guard against an over-loose fix.shlex, no shell split, no expansion check, no relative-slash check, no.., no packed-path check, no/proc/self, no/dev/fd,cdon unsplit words, no backslash check, no NUL guard, no Bash branch, parse error opening). Two redundant constructs the mutants showed were dropped.readygates: local code and security reviews (both CI lanes readlocal) found the fail-open on unresolvable paths; fixed over two rounds, the second review adding packed, parent and self paths. The four bot review threads (bare relative words, unnormalized/proc//self) are fixed in 48e1957.scripts/run-plugin-tests.sh: all 5 pass.scripts/run-ruff.sh checkexit 0,format --checkclean.scripts/check-affected.sh --tests: 13 passed, 1 skipped.Related
attach-asks-before-attaching.🤖 Generated with Claude Code