Skip to content

fix(evals): let run-validity downgrade a Bash denial on a path outside the plugin - #9517

Merged
kyle-sexton merged 7 commits into
mainfrom
fix/9472-bash-denial-paths
Oct 23, 2026
Merged

kyle-sexton merged 7 commits into
mainfrom
fix/9472-bash-denial-paths

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Closes #9472

Summary

run-validity.py could never downgrade a with-arm Bash permission denial to a warning. A Bash call carries command, not a path key, so inside(None, roots) returned True and every with-arm Bash denial made the run INVALID, even a read of /proc in a run that scored the same as the denial-free runs.

Fix

  • New bash_paths(command): shlex.split the command, split each word again at quotes, redirects, pipes, parentheses and = (so --file=/x, >/x and python3 -c "open('/x')" count), and keep the rooted values.
  • A Bash denial counts as inside the plugin when any of those paths is under or above a plugin root. It also counts as inside (fails closed to today's verdict) when the command does not parse, has no rooted path, or holds anything the check cannot resolve: a shell expansion ($, backtick, glob, leading ~), any word after the command word that is neither rooted nor a flag (it resolves against an unknown cwd, so cat SKILL.md /proc/version and grep foo /proc/x both stay INVALID), a relative path with a slash, a path packed after another character (/a:/b, /a,/b), or a /proc/self, /proc/thread-self or /dev/fd path after normpath (they resolve against the validator's own process).
  • inside() treats a path holding a NUL byte as inside instead of crashing in realpath.
  • Other tools are unchanged: their target is still the file_path/path input.
  • SKILL.md's denial paragraph states the Bash rule within the 500-line cap; changelog fragment for evals (patch).

Verification

  • New tests in test_run_validity.py: a Bash cat /proc/sys/kernel/yama/ptrace_scope denial scoring the same is a WARN with a VALID verdict (fails on main). Bash denials naming a plugin path (direct, ancestor, --file=, >, quoted in python3 -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 on main by design, since today every Bash denial is INVALID; they guard against an over-loose fix.
  • Mutation check over the new branches: every mutant killed (whitespace split instead of shlex, no shell split, no expansion check, no relative-slash check, no .., no packed-path check, no /proc/self, no /dev/fd, cd on unsplit words, no backslash check, no NUL guard, no Bash branch, parse error opening). Two redundant constructs the mutants showed were dropped.
  • ready gates: local code and security reviews (both CI lanes read local) 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.
  • evals plugin suites via scripts/run-plugin-tests.sh: all 5 pass. scripts/run-ruff.sh check exit 0, format --check clean. scripts/check-affected.sh --tests: 13 passed, 1 skipped.

Related

  • Issue: #9472
  • Seen on #9328's case attach-asks-before-attaching.

🤖 Generated with Claude Code

kyle-sexton and others added 6 commits October 23, 2026 18:36
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]>
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]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 23, 2026 22:54
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T22:56:34.137927Z 0aeea89 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 1 inline finding(s) on 0aeea89dec9fcdc13556355e70e014e29ba3d124; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 48e19571b60ab0012f102e3d081c48ff73f81c1d: 0 finding(s), 0 as inline comments.

Incremental review of 48e1957 (changes since 0aeea89): no findings.

I read .claude-lane/incremental.diff and .claude-lane/pr-context.md, plus rooted() and inside() in run-validity.py. I did not run the code or the tests.

What the change does

  • It adds a rule that any later word that is neither rooted nor a flag makes bash_paths fail closed.
  • It matches OWN_PROCESS after posixpath.normpath, so /proc//self, /./proc/thread-self and /dev/./fd/3 are caught.
  • It drops the cd/pushd/popd and backslash special cases. Neither leaves a hole:
    • A cd followed by another command always has a bare command word after it, which the new rule fails.
    • A lone cd /x is already checked by the path test.
    • shlex decodes backslash escapes before the check.

Fail-open check
I looked for ways a cwd-relative path could reach the plugin without a path, a slash or a non-flag relative word. These cases all fail closed: cat -- SKILL.md, /bin/cat SKILL.md, FOO=/x cat SKILL.md /proc/v, <SKILL.md cat, a leading redirect, and ... I did not find a bypass.

Closing issue #9472

  • "Treat the call as inside only when one of those paths falls under, or contains, a plugin root": met, covered by the inside-the-plugin and ancestor tests.
  • "Add one test where a Bash denial on /proc/... with equal scores gets the warning": met. The new test also covers a flag, a redirect and a quoted path.
  • "Add one test where a Bash denial on a plugin-root path stays INVALID": met.
  • Each new fail-closed shape has a test: bare relative word, ls /proc ., unnormalized self paths, ./run.sh.

Manifest items
The diff touches no plugin.json or marketplace.json. The changelog fragment is bump: patch, which fits a bug fix.

Known trade-off, not a finding
The new rule also fails closed on compound commands such as cat /proc/v | head, ls /proc 2>&1 and python3 -c "open('/x')". This only keeps today's INVALID verdict for them, and the fragment and SKILL.md describe the rule accurately.

Nothing here adds model spend or touches a trust-gated path, so there is no hold.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-security-review: 2 inline finding(s) on 0aeea89dec9fcdc13556355e70e014e29ba3d124; the summary is in this lane's pull request comment.

claude-lane: claude-security-review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 48e19571b60ab0012f102e3d081c48ff73f81c1d: 0 finding(s), 0 as inline comments.

No security issues in the incremental change since 0aeea89. I read .claude-lane/incremental.diff, the PR context and the changed bash_paths, denials and inside code in run-validity.py.

The change tightens the fail-closed behaviour of bash_paths:

  • Any relative word after the command word that is not a flag now makes the denial count as inside the plugin. This replaces the old cd/pushd/popd and backslash checks.
  • The /proc/self, /proc/thread-self and /dev/fd check now runs on posixpath.normpath(v) with a ^/+ prefix, so /./proc/thread-self, /proc//self and /dev/./fd no longer slip through.
  • The shlex parse already handles backslash escapes. cd /tmp && cat x still fails closed, because cat and x are non-rooted, non-flag words after the first.

I looked for ways to get a denial on a plugin file downgraded to a warning:

  • Flag-glued relative paths such as -nSKILL.md would pass, but they are not meaningful arguments to real commands.
  • /proc/<pid>/... is not treated as the validator's own process. It resolves only if the pid matches the validator's, which an agent cannot target in practice.
  • Neither leaves an exploitable path to a security-relevant outcome.

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 plugin.json or marketplace.json change.
Instruction surface: the SKILL.md edit rewrites a description of the validator's rule and removes no guardrail. The rule is still enforced in code and was made stricter. The instruction exception register was not consulted, because the change removes no standing instruction.

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]>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit b37ae04 Oct 23, 2026
34 checks passed
@kyle-sexton
kyle-sexton deleted the fix/9472-bash-denial-paths branch October 23, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(evals): let run-validity downgrade a Bash denial on a path outside the plugin

1 participant