Repository navigation
fix(guardrails): block a home path in attach alt text after a non-boundary character - #16347
Conversation
…erand Since the --attach narrowing, a Bash-tool `gh pr|issue ... --attach` operand was judged for paths only by the text after its first `#` and its base name. A home path in the alt text after a character the path patterns do not accept as a left boundary (a second `#`, `,`, `;`, `|`, `<`, `-` or a letter) then matched nothing and the call posted it, where before it was blocked by the source directory. When the alt text holds `/` or `\`, judge the whole operand plus that text; otherwise keep the narrowing, so an alt text without a slash beside a home-directory source stays quiet. An alt text holding a slash beside a home-directory source blocks again, failing closed. Also hoist the loop-invariant tool and form check out of the word loop in github-post-body.sh and correct its header's description of the `attach` kind. Refs: #15979 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015te8Csz4bqxpok4iu8Mcrd
Codex Review Summary: ✅ CompletedThis 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. |
Lane run report
Failed GitHub API calls
|
|
claude-security-review reviewed Security review: PR #16347 (head 3f96537)I found no security issues. What changed. The Why it tightens the guard.
Other notes.
critical-findings: 0 |
|
claude-review reviewed Code review: no findings. I read every hunk of all 5 changed files. What changed. The
Library refactor. The library change in Tests. The six new
The PR body says the Known gaps the author states.
Docs and changelog. The README row, the hook header, the library header and the changelog fragment all describe the new rule correctly. Closing issue. The PR refers to #15979 but closes no issue, and the PR context file has no closing-issue section, so there were no acceptance criteria to check. Path-scoped rules. The PR context file held no embedded instructions. Verifier dropped 0 of 0 candidates. |
Refs: #15979
Summary
The security pass the issue requires (its AC17), run on the merged attach change (#16066), found one regression: under the Bash tool,
block-github-post-contentlet agh pr|issue ... --attachoperand through when its alt text held a home path after a character the path patterns do not take as a left boundary (a second#,,,;,|,<,-or a letter). Before #16066 the operand's source directory blocked those calls. gh posts the alt text, so the path reached GitHub. This PR blocks them again.Fix
#holds/or\, the guard judges the whole operand plus that text, as it did before fix(guardrails): stop judging gh --attach source paths as posted machine paths under Bash #16066 plus the adjacent-alt case. An alt text with no slash keeps the narrowed judging (alt text and base name), so the false positive fix(guardrails): stop judging gh --attach source paths as posted machine paths under Bash #16066 removed stays removed.<home>/x.png#before/after). A relative source with the same alt text still passes.attachtext is judged.--attachoperand is still judged whole.Verification
denycases (second#,,, joined--attach=, a letter before the path,gh issue create, and the slash-in-alt case) failed on the unfixed hook,PASS=187 FAIL=12; a newquietcase for a relative source with a slash in its alt text passed.block-github-post-content.test.shprintsPASS=199 FAIL=0(run again by the session that opened this PR);block-fix-request-post.test.sh316 passed,run-guards740 passed, shellcheck clean.run-guards.sh: the nine leaking shapes and the slash-in-alt case exit 2;<home>/x.png#Banner before resize, a bare--attach <home>/x.pngand./x.png#before/afterexit 0.Left out: the
;,|,<and-shapes were probed but have no test case of their own; a liveghpost was not made.Related
--bodyvalue and in an attach whose source is relative. Its fix belongs in the path patterns' boundary class.Remaining
--attachstays judged whole by the owner's decision.Follow-ups
plugins/guardrails/lib/path-detection/hardcoded-path-patterns.sh,_posix_boundary) accepts only line start, whitespace, a quote, a backtick,(,=,:orfile://, so a home path that follows,,;,#,|,<,-or a letter passesblock-github-post-contentin a--bodyvalue and in the alt text of an--attachwhose source is relative. Present before fix(guardrails): stop judging gh --attach source paths as posted machine paths under Bash #16066. The boundary exists so a URL path is not read as a filesystem root, and the commit and push content scans share it, so widening it needs its own change with false-positive checks across those consumers.🤖 Generated with Claude Code
https://claude.ai/code/session_015te8Csz4bqxpok4iu8Mcrd