fix(checks): CI rules fired on YAML comments; tighten pull_request_target to the real trigger - #18
Merged
Merged
Conversation
…rget Every rule in scan_ci_permissions matched raw added text, so a workflow that *documented* a risk tripped the rule that exists to catch it. Found in the field: Signetry/core#92 was returned Block with two findings pointing at these lines — # We deliberately do NOT use `pull_request_target`: that runs with a writable # here safe, unlike `pull_request_target` + checkout of PR head. — i.e. prose explaining why the trigger is deliberately avoided. The same hole applied to permissions: write-all, id-token: write and curl|sh. * Skip whole-line YAML comments. Inline trailing comments are still scanned on purpose: `#` is legal inside a quoted scalar, so stripping it by regex could hide real configuration. * ci.pull_request_target now matches the trigger rather than the string, in every form YAML allows: mapping key, `on:` scalar, inline sequence, and block sequence item. The pre-existing test only covered the `on: pull_request_target` scalar; running it caught that a key-only match would have regressed the other shapes. Two new tests: all four trigger forms, and the five comment shapes that previously produced false findings.
3 tasks
bkd-dotcom
added a commit
that referenced
this pull request
Aug 18, 2026
The dependency-skew check (#16, #19) plus the CI-comment false-positive fix (#18). Minor bump rather than patch because a new deterministic check landed, not just fixes. Also fixes a stale pin: action.yml fell back to @v0.1.1 even after v0.1.2 shipped, so any workflow not setting signetry-reviewer-version silently installed a release behind. Co-authored-by: Binay <bkd-dotcom@users.noreply.github.com>
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.
The bug
Every rule in
scan_ci_permissionsmatches raw added text, with no comment handling. So a workflow that documents a risk trips the rule that exists to catch it.This was found in the field, not in theory. Signetry/core#92 — a PR whose entire purpose was to avoid
pull_request_target— was returned 🔴 Block, with two findings pointing at:Both are comments. The reviewer blocked a PR for explaining why it doesn't do the dangerous thing.
The same hole applied to every other rule in the function —
permissions: write-all,id-token: write,curl … | sh, anduses:pinning all fired from prose.The fix
Skip whole-line YAML comments. Inline trailing comments are deliberately still scanned:
#is legal inside a quoted scalar, so stripping trailing comments by regex risks hiding real configuration. Documented in the code.ci.pull_request_targetnow matches the trigger, not the string — in every form YAML permits:pull_request_target:(mapping key)on: pull_request_target(scalar)on: [push, pull_request_target](inline sequence)- pull_request_target(block sequence item)Worth noting: the pre-existing test only covered the
on: pull_request_targetscalar. My first pass matched the mapping key only — running the existing suite caught that it would have silently regressed the scalar form. That's now pinned by a test over all four shapes.Verification
25 tests pass (23 existing + 2 new),
ruffclean. The new tests assert:Follow-up needed to land this in the field
Signetry/core's workflow pinssignetry-reviewer @ git+…@v0.1.2, so this fix has no effect there until a new tag is cut and the pin is bumped. I've left the release itself to you rather than tagging unilaterally — say the word and I'll cutv0.1.3and open the pin bumps across the repos that install the reviewer.