Repository navigation
feat(untrusted-checkout): cover issue_comment workflows that build a pull request - #206
Merged
Merged
Conversation
…ctions/checkout Since v7, and on 2026-07-20 in the floating tags of every older major but v1, actions/checkout refuses to check out the code of a fork pull request in pull_request_target and in workflow_run workflows that a pull request started. A checkout that the protection refuses is no longer reported (floating tag v2 to v7, release at or above v2.8.0, v3.7.0, v4.4.0, v5.1.0, v6.1.0, or a commit whose version comment names one); with the option pedantic it is reported and the message says that only pull requests from a branch of the repository get through. A release below the floors, v1 and a commit without a version comment stay reported, with a hint to upgrade. allow-unsafe-pr-checkout: true (or an expression) is a finding of its own on that line. git and gh checkouts, branch names, other events (issue_comment, issues, workflow_call) are not covered by the protection and stay reported. Part of #167 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…pull request A workflow that a comment starts and that runs gh pr checkout of the issue number, refs/pull/<number>/head or the head that xt0rted/pull-request-comment-branch (and alessbell/, eficode/resolve-pr-refs, potiuk/get-workflow-origin, github/branch-deploy) found is reported like a pull_request_target one. Gates are accepted: author_association restricted to people with access (NONE and CONTRIBUTOR are not), permission-check actions that fail the job, a github-script that checks the permission and throws, an environment, and a needed job that is skipped or fails for an untrusted user. A job or step that github.event_name keeps away from the privileged events is no longer judged for them, and the message says when the job token can only read. Part of #167 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 42 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Oct 13, 2026
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…job back, and its environment is judged like the job's own A job that needs a job whose if is false for the event is skipped with it. The environment of a needed job holds the job back only when the online checks do not find that it has no required reviewers, the same predicate as for the environment of the job itself. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…and GITHUB_ENV, judge a step for its own events, and let a failed permission check that the job ignores go on gh pr checkout of the number of the pull request that a comment is on is found in the script files that a step starts and when an earlier step wrote the number to GITHUB_ENV. A step with an if on github.event_name is judged for the events it runs for. A job that needs a job whose permission check has continue-on-error is not held back by it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…f the workflow, the job and the step into GITHUB_ENV Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…the number of a comment unless it is the last unconditional one Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f6ebd64. Configure here.
…s it needs run Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
jdx
enabled auto-merge (squash)
October 13, 2026 14:32
This was referenced Oct 13, 2026
jdx
added a commit
that referenced
this pull request
Oct 13, 2026
…l reusable workflows and composite actions (#208) **Based on `main`; it contains the commits of #203 (checkout protection) and #206 (issue_comment), which GitHub shows in the diff until they are merged. Merge them first. (The earlier PRs #183 and #193 of this stack were merged into stack branches only and never reached `main`; #203 and #206 replace them.)** ## What `untrusted-checkout` follows the head of a pull request through local reusable workflows and local composite actions (CodeQL treats `workflow_call` as privileged when its caller is, poutine has the event `workflow_call`; sisakulint FP reports #580/#587 show it must be caller-aware). Details are in `docs/checks.md`. - **Callee side.** A reusable workflow or composite action is judged for each call in a workflow of the project: the call counts when its workflow has a privileged event (`pull_request_target`, `workflow_run`, `issue_comment`) and neither the job nor the step of the call is guarded (environment, guard condition, permission gate before the step, a guarded needed job, `github.event_name`). A caller that is itself reusable passes its own callers on (three levels). An input is untrusted when a counting call fills it with the head of a pull request (a context or `refs/pull/...`, or an untrusted input of its own caller); `actions/checkout` with `ref: ${{ inputs.ref }}` followed by `make` is reported at the checkout and says which workflow gives the head (`inputs.ref, given github.event.pull_request.head.sha by .github/workflows/pr.yaml`). A reusable workflow that names the head itself is privileged by its callers too. - **Caller side.** A composite action that only checks out (`ref: ${{ inputs.ref }}`) and a caller that runs the code in a later step: the `uses:` of the action is the checkout, with the values of the call (and the defaults of the action) in place of its inputs; guarded steps of the action are skipped. - The checkout protection of #183 is judged for the events that reach the callee, and a `workflow_call` workflow is only "all covered" when every caller is known. - **Unknown stays unknown**: a callee that no workflow of the project calls, a call through a composite action that calls another one, a value from a step output, a matrix or a `needs` output, a `uses:` with an expression, a call made by a composite action (the graph of `action_graph.go` is not used for this: it does not keep the job and step of a call, which the guards need, so the calls are indexed from the workflows once per run (`siblingWorkflows`) and the calling workflow is re-read only for a callee that is being linted). Part of #167 (ideas-others item 2). ## Tests `TestUntrustedCheckoutCallers` (21 cases: passed head, literal, unknown value, wrong event, environment, guard condition, event condition, needed guarded job, two levels, other input, own context, comment number, composite action, permission gate, mixed guarded/unguarded calls), `TestUntrustedCheckoutCallersGuard`, `TestUntrustedCheckoutLocalActionCheckout`, and the fixture `testdata/actions/untrusted_callers` (reusable workflow, composite action and checkout-only action; the base checkout is not reported). `go build`, `go vet`, `go test ./...` (and `-race` on the rule tests) and `hk check --all` pass locally. ## Corpus Same 379 repositories, now with the 313 local composite actions linted as well, default profile: #193 had 28 findings, this branch has **28, identical**. So no finding was added or removed on real repositories, and the new code paths have **no measured rate**: of the 664 privileged workflows of the corpus 85 call a local action or workflow, and 25 have something that looks like the head of a pull request near the call; I read five of those (grafana storybook, superset docs deploy, streamlit playwright, cilium base images, kafka pr-labeled): the head is only used for names, SHAs in messages or a status, never as the ref of a checkout, so none is a missed shape. This is a limit of the corpus (popular repositories rarely do this), not evidence that false positives are absent: that is covered by the guards tests only. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Security-rule behavior changes how privileged workflows are analyzed across call graphs; risk is mitigated by extensive tests and unchanged corpus findings, but false positives/negatives remain possible on edge cases explicitly left unknown. > > **Overview** > Extends **`untrusted-checkout`** so privileged callers cannot hide untrusted PR checkouts inside **local reusable workflows** or **composite actions**. The linter indexes project workflows for `uses:` / `workflow_call` edges (up to three levels), propagates tainted inputs and comment PR numbers into callees, and reports findings on the callee checkout (or on the caller’s `uses:` when the composite only checks out and the caller runs the code). > > **Caller/callee modeling** substitutes call inputs into composite steps, honors input defaults, respects the same guards as inline jobs (environment, `author_association`, needed jobs, permission gates—including **parallel step groups** and steps that run on **`always()` / `failure()`** after a failed permission check), and applies **`actions/checkout` fork protection** using the events that actually reach the callee. > > **Supporting refinements:** stricter **`author_association`** guard detection, tighter **`refs/pull/N`** handling for checkout protection (`refIsPullNumber`), and docs/parity notes for what is and is not followed (step outputs, nested composite chains, unknown callers). Large fixture and unit/online test coverage added; no change reported on the existing corpus (28 findings). > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 38064d5. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * The untrusted-checkout check now covers workflows triggered by pull-request comments, including cases where pull-request code is checked out and run. * Analysis now follows untrusted pull-request references through local reusable workflows and composite actions, and accounts for permission checks, job conditions, and environment protections. * Findings distinguish read-only token permissions from jobs with no token permissions. * **Documentation** * Updated guidance and rule descriptions to explain coverage of comment-triggered workflows and the analysis of pull-request references and safeguards. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
jdx
added a commit
that referenced
this pull request
Oct 13, 2026
…nt of code that can change, and labels that last (#220) **Based on `main`, and contains the commits of #203 (checkout protection), #206 (issue_comment) and #208 (callers), which GitHub shows in the diff until they are merged: merge those first. (The earlier PRs #183 and #193 of this theme were merged into stack branches only and never reached `main`.)** This is the last PR of the theme, the changes of this PR are the last two commits. ## What TOCTOU (CWE-367) for `untrusted-checkout` (CodeQL `UntrustedCheckoutTOCTOUCritical/High` and `ControlChecks`, gato-x `approval_gate` and `dispatch_toctou`, https://github.com/AdnaneKhan/ActionsTOCTOU, zizmor#935). jactionlint suppressed the finding when the job had an `environment:` or a label/comment guard; that is only sound when the code is an immutable commit. They are messages of the same rule ID (one ID per audit), details and the gate table are in `docs/checks.md`. 1. **A gate that holds at one moment, and a ref that can change** (default profile). The gates: an `environment:`, a label condition (`github.event.label.name` or `github.event.pull_request.labels`), and in a workflow that only a comment starts a check of the commenter (`author_association` of the comment, `github.actor`, `comment.user`, a permission check step or a guarded/environment job that this one needs). The refs: `head.ref`, `github.head_ref`, `workflow_run.head_branch`, `head_ref`/`fork_ref` of the actions that look a pull request up, `refs/pull/N/head|merge`, short `pull/N/head`, `gh pr checkout`. A commit (`head.sha`, `merge_commit_sha`, `head_sha`) is not reported: the reviewer saw that commit. Gates that hold after a push still stop the job: the author is checked (`author_association` of the PR, `github.actor`, the head repository, a permission check in `pull_request_target`), and `needs`/`steps` conditions, which are not judged. A step after the checkout that reads the commit (`git rev-parse HEAD`, `git log -1`), compares it with something named sha/revision/commit/expected/verified and stops the job counts as the check that it is the reviewed commit. 2. **A label that lasts** (default profile): `contains(github.event.pull_request.labels.*.name, ...)` in a `pull_request_target` workflow whose types include `opened`, `synchronize` or `reopened` (the default), whatever the ref: each later push runs with the label. Not reported when the job removes the label (`--remove-label`, `removeLabel`) or when the condition is tied to the event (`github.event.action == 'labeled'`, `github.event.label.name`). 3. **`workflow_dispatch` with the number of a pull request** (option `pedantic`): an input called `pr`, `pr_number`, `pull`, ... and no required input with `sha`, `commit` or `rev` in its name, with `refs/pull/<input>/head|merge` or `gh pr checkout <input>` and code that runs (gato-x `dispatch_toctou`). 4. **Item 26, `any-checkout`**: a new rule option (on under `profile: pedantic`, like the `pedantic` option; it is not turned on by `pedantic: true` of the rule, which keeps the existing tests' semantics) that reports a PR-head checkout in a `pull_request_target`/`workflow_run` job when nothing visibly runs it and no gate is in front of it (Scorecard Dangerous-Workflow and Semgrep parity). I made it a separate option because it reports a different thing (a checkout with no executor) from the other pedantic message and users compare with Scorecard on that alone. Other changes needed for it: the `environment:` and guard exits of `VisitJobPre` became a gate classification (`untrusted_checkout_toctou.go`, `gateInfo`: safe / stale / label-that-lasts) that is carried to the report, and the `allow-unsafe-pr-checkout` finding is not reported for a gated job (the gate is what judges it, as before). Part of #167 (ideas-others items 5, 27 and 26; ideas-zizmor item on TOCTOU refs). The gates that #206 accepts for comments are the "stale" ones here: `docs/checks.md` says so. ## Tests `TestRuleUntrustedCheckoutToctou` (41 cases: each gate with each ref, commit vs branch, the author gates that must stay quiet, needs chains, comment gates, a verification step, label tied to the event or removed, dispatch with and without a commit input), `TestRuleUntrustedCheckoutAnyCheckout`, goldens `testdata/err/untrusted_checkout_toctou.*` and `testdata/ok/untrusted_checkout_toctou.yaml`. The tests of #206 that used a gate with a mutable ref now use the commit of the pull request (`steps.pr.outputs.head_sha`), and two older tests whose label gate was meant to be a gate of the `labeled` event now say `types: [labeled]`. `go build`, `go vet`, `go test ./...` and `hk check --all` pass. ## Corpus 379 repositories / 4650 files, 313 composite actions, default profile. Baseline = #208 (28 findings): **47 findings, 19 new, 0 removed**. All 19 are a comment gate (`github.event.comment.user.login == github.repository_owner`, `author_association`, `lannonbr/repo-permission-check-action`, `sushichop/action-repository-permission`, ...), 3 with an `environment:` too, in front of `steps.comment-branch.outputs.head_ref` or `refs/pull/<issue number>/merge` (SlimHUD release, ant-design-mini, diffgram, koobiq, openfoodfacts, Homm3BG, ...): an owner/maintainer comments, the author pushes, the job builds or releases what is there. I read each of them; none checks the commit afterwards (the repositories that do, `huggingface/transformers`, `argumentcomputer/ix` and `nodejs/node`, are exactly the ones that the verification-step rule keeps quiet; I added the `[ ... ] ` form and `revision`/`commit` names after the first run showed them as false positives). No finding of the "label that lasts" kind and none of environment with a branch in a `pull_request_target` workflow exists in the corpus, so those two have **no measured rate**. With `--profile pedantic` 3 more: 2 dispatch (`pnpm/pnpm` benchmark.yml, `zed-industries/zed` autofix_pr.yml) and 1 `any-checkout` (`cilium/cilium` lint-build-commits.yaml:47). The rule is more precise than it was: the previous suppression by the environment/label/comment guard hid these 19. Risk to review: item 1 now reports workflows that were silent because of a comment gate. That matches CodeQL, and the attack needs the author of the pull request to push right after a maintainer's comment, but it is a finding on code that a maintainer "approved" by commenting; if that is too noisy for the default profile, moving item 1 for comment gates to `pedantic` is a one-line change in `reportToctou`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes default security lint findings for workflows that relied on environment/comment gates with branch checkouts; behavior is intentional but may surprise maintainers and add noise until workflows pin commits. > > **Overview** > Extends **`untrusted-checkout`** with **time-of-check/time-of-use (TOCTOU)** analysis so “approval” gates no longer silence findings when the job still checks out **mutable** PR refs (branches, `refs/pull/N/head`, `gh pr checkout`, etc.) instead of a fixed commit. > > The rule now classifies guards as **holding** (author/trust checks) vs **one-moment** (environment, event label, commenter permission) vs **labels that persist** across `pull_request_target` push reruns, parses ref expressions into commit vs mutable sources, and emits dedicated messages (same rule ID) with guidance to pin `head.sha` or verify the checkout. **Pedantic** mode adds **`workflow_dispatch`** PR-number-without-commit checks; new **`any-checkout`** (default in pedantic profile) flags privileged PR checkouts when no later step visibly executes the code. The same gate logic applies to **reusable workflows and composite actions** via caller/callee gate merging. > > Docs, config schema, fixtures, and large test suites (`TestRuleUntrustedCheckoutToctou`, gate model table, caller TOCTOU) document and lock behavior; sample “safe” workflows now checkout commit SHAs after comment gates. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 6a98628. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Expanded untrusted-checkout checks to trace pull request references through reusable workflows and composite actions. * Added detection for mutable references and persistent label gates that can become inconsistent after a pull request update. * Added the `any-checkout` option to report privileged workflow checkouts even when later code execution is not visible. It is enabled by default in the pedantic profile. * Pedantic checks now flag certain manually dispatched workflows that check out a pull request without specifying a commit. * **Documentation** * Updated rule guidance with coverage details and examples. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
jdx
added a commit
that referenced
this pull request
Oct 14, 2026
🤖 I have created a release *beep* *boop* --- ## [2.2.0](v2.1.0...v2.2.0) (2026-10-14) ### Features * **action-input-dependencies:** report inputs of well-known actions that need each other ([#207](#207)) ([ef17270](ef17270)) * **action-release-cooldown:** report an action at a version younger than N days (online, opt-in) ([#235](#235)) ([7dbd838](7dbd838)) * **action:** check the inputs of any remote action against its action.yml with --online ([#231](#231)) ([ac30cbe](ac30cbe)) * **actions-lock:** lint GitHub's Actions lock file against the workflows ([#237](#237)) ([c9d8944](c9d8944)) * **argument-injection:** report free text in the program or the options of sed, awk, find and tar ([#221](#221)) ([ecf46dc](ecf46dc)) * **aube:** understand aube in the rules that know npm, pnpm, yarn and bun ([#254](#254)) ([f6d9319](f6d9319)) * **cache-poisoning:** add pnpm/setup, graalvm and composer, and report caches of credential files ([#216](#216)) ([e3c29f0](e3c29f0)) * **cache-poisoning:** report more zizmor findings and add a pedantic tier ([#160](#160)) ([c725459](c725459)) * **cli:** add --ruff, --show-doc-urls, --finding-context, platform forgejo and jujutsu roots ([#215](#215)) ([8e31c5c](8e31c5c)) * **cli:** add shell completions and --explain RULE ([#204](#204)) ([b3b09d3](b3b09d3)) * **cli:** add the options select, no-ignores and list-rules ([#200](#200)) ([dca5092](dca5092)) * **cli:** show only the findings on what changed since a revision (--changed-since) ([#274](#274)) ([ea0ac90](ea0ac90)) * **command-injection:** report input that a script runs as code after it moved to env ([#202](#202)) ([ebeeb6f](ebeeb6f)) * **comment-trigger-authorization:** report comment-triggered jobs that do not check who commented (pedantic) ([#217](#217)) ([60fa75e](60fa75e)) * **concurrency-deadlock:** report a group that a workflow shares with the workflow it calls ([#210](#210)) ([c41e2ad](c41e2ad)) * **concurrency-limits:** report schedule-only and manual-only workflows (pedantic) ([#266](#266)) ([c1ec820](c1ec820)) * **config:** JSON Schemas for the config file and for --format json ([#195](#195)) ([5f83de6](5f83de6)) * **dangerous-triggers:** say what the token and the secrets can do, and make a workflow without privileges pedantic ([#189](#189)) ([97e79e7](97e79e7)) * **deprecated-node-runtime:** report a Node.js runtime that GitHub removed in the metadata of an action (pedantic) ([#225](#225)) ([84dd922](84dd922)) * **deprecated-node-runtime:** report popular actions at majors that declare node20 (pedantic) ([#230](#230)) ([8a9fc95](8a9fc95)) * **deprecated-node-runtime:** report the environment variables that chose the Node.js runtime (pedantic) ([#234](#234)) ([6531d87](6531d87)) * **environment-file-redirect:** report writes to GITHUB_OUTPUT that lose the data ([#184](#184)) ([79cc5ef](79cc5ef)) * **event-name-never-received:** report github.event_name compared with an event the workflow never receives ([#214](#214)) ([b3bfcc4](b3bfcc4)) * **external-tools:** say when shellcheck or pyflakes did not run ([#188](#188)) ([f7280e5](f7280e5)) * **facts:** export the events, permissions, concurrency and calls of a repository as versioned JSON (--export-facts) ([#272](#272)) ([881dde9](881dde9)) * **fail-fast-action-inputs:** report actions that pass when nothing was produced ([#196](#196)) ([f856144](f856144)) * **fix:** say why more findings have no fix, add --show-fix-status and the fix prerequisites to --explain ([#269](#269)) ([7aa3187](7aa3187)) * **gh-without-token:** report the gh command without GH_TOKEN or GITHUB_TOKEN ([#177](#177)) ([1d997da](1d997da)) * **github-app:** check two more token actions and cover local composite actions in dependabot-missing-actions-update ([#229](#229)) ([e5b620e](e5b620e)) * **github-env:** follow text that a script reads with gh and git ([#218](#218)) ([9d0a4bb](9d0a4bb)) * **github-script-syntax:** check the JavaScript of actions/github-script with node --check ([#242](#242)) ([f106562](f106562)) * **hardcoded-registry-credentials:** report credentials in plain text in the registries of dependabot.yml ([#265](#265)) ([765521c](765521c)) * **macos-gnu-flags:** report GNU-only options in run scripts of macOS jobs (pedantic) ([#241](#241)) ([871c07d](871c07d)) * **malformed-expression-delimiters:** report ${ github.ref }, $ {{ x }} and {{ github.sha }} ([#180](#180)) ([e452449](e452449)) * **missing-version-comment:** report a hash pin without a version comment and add it with --online --fix ([#232](#232)) ([97767b4](97767b4)) * **multiline-plain-run:** report a run folded into one line ([#205](#205)) ([f4e76c4](f4e76c4)) * **online:** look up the actions of a GitHub Enterprise Server on github.com ([#250](#250)) ([d8a1280](d8a1280)) * **online:** report coverage and cache freshness outside SARIF ([#166](#166)) ([5fd779e](5fd779e)) * **online:** report the jobs whose environment has no required reviewers ([#247](#247)) ([6c13781](6c13781)) * **output-clobbering:** report input with line breaks written to GITHUB_OUTPUT as a record ([#212](#212)) ([c992eef](c992eef)) * **permissions:** report a job whose permissions are too narrow for its actions ([#192](#192)) ([07d78b7](07d78b7)) * **ref-version-mismatch:** fix the version comment (unsafe) and read ratchet comments ([#227](#227)) ([60842f7](60842f7)) * **release:** publish wheels to PyPI with go-to-wheel ([#277](#277)) ([0440a3a](0440a3a)) * **repojacking:** report an action whose owner name anyone can register ([#248](#248)) ([3b62077](3b62077)) * **runner-label:** accept the labels of hosted-runner providers ([#199](#199)) ([27e453c](27e453c)) * **runner-label:** check runner labels built from a matrix value and text ([#233](#233)) ([b67bbd4](b67bbd4)) * **runner-label:** warn ahead of the retirement of a runner label and name it afterwards ([#182](#182)) ([0c3756b](0c3756b)) * **sarif:** say why a finding with a fix has none in the log ([#164](#164)) ([7a2a509](7a2a509)) * **self-hosted-runner:** count the configured labels and runner groups, and say when a pull request reaches the runner ([#194](#194)) ([80c43f8](80c43f8)) * **shell-syntax:** report syntax errors in run scripts without shellcheck ([#273](#273)) ([31ee66e](31ee66e)) * **shellcheck:** read a shellcheckrc, extra arguments and optional checks from the config ([#191](#191)) ([4d02a46](4d02a46)) * **superfluous-actions:** resolve runs-on expressions the repository tells ([#271](#271)) ([22a3f8e](22a3f8e)) * **template-injection:** report more free text of outsiders in the default profile ([#173](#173)) ([08afe4a](08afe4a)) * **timeouts:** report how long jobs really took in their latest runs (--suggest-timeouts) ([#275](#275)) ([033f615](033f615)) * **ubuntu-slim:** report what the single-CPU runner cannot run ([#190](#190)) ([51a5e7f](51a5e7f)) * **undefined-property:** check the properties of github.event against the webhook payloads ([#249](#249)) ([81a1038](81a1038)) * **unlocked-install:** model the lifecycle scripts and the release age of aube (pedantic) ([#255](#255)) ([f5dfab7](f5dfab7)) * **unlocked-install:** report installs without a release-age cooldown (pedantic) ([#201](#201)) ([13779f6](13779f6)) * **unlocked-install:** report npm, yarn and bun installs that run lifecycle scripts (pedantic) ([#187](#187)) ([ee74c67](ee74c67)) * **unmatched-paths-filter:** report paths filters that match no file of the repository (pedantic) ([#238](#238)) ([2baf2cb](2baf2cb)) * **unpinnable-action:** report a hash-pinned action whose own dependencies are not pinned ([#240](#240)) ([3cc0ddb](3cc0ddb)) * **unpinned-images:** check docker run images in scripts, add per-image policies and image allow/deny lists ([#211](#211)) ([376b065](376b065)) * **unpinned-images:** pin container images to a digest with --online --fix=unsafe ([#239](#239)) ([2f63474](2f63474)) * **unpinned-uses:** accept a ref which the Actions lock file pins to a commit ([#228](#228)) ([c702b7c](c702b7c)) * **unpinned-uses:** accept the tag of an immutable release under --online ([#251](#251)) ([c112760](c112760)) * **unpinned-uses:** name the most specific version tag in the comment of --online --fix ([#224](#224)) ([84dd5fc](84dd5fc)) * **unredacted-secrets:** report values cut from a secret and printed by a script (pedantic) ([#222](#222)) ([c45a29f](c45a29f)) * **untrusted-artifact:** know more download actions and report a download of every artifact with the option pedantic ([#219](#219)) ([bc216f9](bc216f9)) * **untrusted-checkout:** count the actions that run the workspace, with the input that makes them do it ([#213](#213)) ([29fea2c](29fea2c)) * **untrusted-checkout:** cover issue_comment workflows that build a pull request ([#206](#206)) ([6b73b42](6b73b42)) * **untrusted-checkout:** follow a pull request revision through variables and script files ([#159](#159)) ([78813f4](78813f4)) * **untrusted-checkout:** follow the head of a pull request into local reusable workflows and composite actions ([#208](#208)) ([29843f2](29843f2)) * **untrusted-checkout:** honor the fork pull request protection of actions/checkout ([#203](#203)) ([1acb258](1acb258)) * **untrusted-checkout:** report gates that hold at one moment in front of code that can change, and labels that last ([#220](#220)) ([09fc91e](09fc91e)) * **use-trusted-publishing:** report jobs that build, lack an environment or drop attestations (pedantic) ([#209](#209)) ([1c26e5f](1c26e5f)) * **workflow-call:** check the calls of reusable workflows of other repositories with --online ([#236](#236)) ([89f2c75](89f2c75)) * **workflow-secret-scope:** job-level secrets, secrets passed to reusable workflows, and unused workflow_call secrets ([#223](#223)) ([e7a53ef](e7a53ef)) ### Bug Fixes * **action:** check popular actions pinned to a full version or to a commit with a version comment ([#174](#174)) ([d324b7c](d324b7c)) * **api:** accept nil LinterOptions, print the rule ID in Error and PrettyPrint, correct API comments ([#283](#283)) ([e2d3304](e2d3304)) * **changed-since:** count shared findings once, keep ..foo inside the repository, refuse --export-facts ([#279](#279)) ([341ccb5](341ccb5)) * **config:** a missing file in "extends" of a discovered config file is an error ([#285](#285)) ([1a848ff](1a848ff)) * **download-script:** report a missing release, accept amd64, fix the help text ([#282](#282)) ([3165939](3165939)) * **if-always-true:** do not report the newlines at the end of a block scalar ([#226](#226)) ([871eb35](871eb35)) * **ignore:** read own-line ignore directives from real YAML comments only ([#284](#284)) ([3f9e648](3f9e648)) * **missing-timeout:** add accept-step-timeouts for jobs whose steps all set timeout-minutes ([#252](#252)) ([10cfa99](10cfa99)) * **multiline-plain-run:** rename commandWords so the package builds again ([#256](#256)) ([24d8900](24d8900)) * **parser:** accept a whole mapping or list written as one expression where the schema allows it ([#178](#178)) ([5689451](5689451)) * **permissions:** report the pedantic persona's permission findings ([#176](#176)) ([016f588](016f588)) * **runner-label:** follow the images behind the -latest labels ([#171](#171)) ([8e6159e](8e6159e)) * **syntax:** accept keys and values the workflow schema allows but the docs do not list ([#170](#170)) ([66df2e0](66df2e0)) * **syntax:** report what the runner rejects in schedules, merge_group, self-repository uses and action.yml ([#186](#186)) ([f498457](f498457)) * **untrusted-checkout:** follow pull/N/head fetches, skip merged pull requests, count sed -f, awk -f, tar -P and unzip -: ([#175](#175)) ([5fd975f](5fd975f)) ### Performance Improvements * analyze each run script once and parse the callers of an action once ([#270](#270)) ([ac37b69](ac37b69)) * bound concurrent workflow checks to cut peak memory on huge repositories ([#158](#158)) ([bbe49da](bbe49da)) * **online:** read the advisories of all actions with one request ([#268](#268)) ([a04bcd2](a04bcd2)) * share the parsed expressions of a string with the rules that still parsed them again ([#165](#165)) ([9bcdbb0](9bcdbb0)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Mechanical version and documentation updates only; no runtime or rule logic changes in the diff. > > **Overview** > **Release Please** bumps the published version from **2.1.0** to **2.2.0** and keeps every `x-release-please-version` marker aligned: `.release-please-manifest.json`, the GitHub Action’s default `version` input in `action.yml`, the `jactionlint-docker` pre-commit image tag, docs site version (`docs/.vitepress/version.ts`), and install examples in `docs/ci.md` and `docs/hooks.md`. > > `CHANGELOG.md` gains the **2.2.0** section (2026-10-14) summarizing what ships in this release—many new lint rules and CLI options (`--changed-since`, `--export-facts`, `--explain`, online action/workflow validation, Actions lock file linting), security-focused checks (untrusted checkout, cache poisoning, repojacking, etc.), bug fixes, and performance work. This PR does not change linter implementation; it is the version and changelog cut for code already on `main`. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit e0e7f9d. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@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.

Replaces #193, which was merged into the stack branch of #183 and never reached
main. This PR is the same change rebased ontomain; it is based onmainand contains the commit of #203 (the checkout protection), which GitHub shows in the diff until #203 is merged. Merge #203 first.What
untrusted-checkoutnow coversissue_commentworkflows (the "/test", "/build" bots), the most common real-world pwn request shape; poutine (untrusted_checkout_exec) and CodeQL (UntrustedCheckoutQuery,ControlChecks) cover it too. Details are indocs/checks.md.gh pr checkoutofgithub.event.issue.number(or thehtml_urlof the issue / itspull_request), directly, inenv:of the step, job or workflow, or in a script variable;refs/pull/<n>/head|mergeandpull/<n>/headwith that number (actions/checkout,git fetch/checkout); andsteps.<id>.outputs.head_sha|head_ref|...ofxt0rted/pull-request-comment-branch,alessbell/pull-request-comment-branch,eficode/resolve-pr-refs,potiuk/get-workflow-origin,github/branch-deploy(outputs checked against eachaction.yml;gotson/pull-request-comment-branchfrom the brief does not exist (404), so it is not listed). The issue number only counts forgh pr checkout, sogit checkout -b fix-${{ github.event.issue.number }}is not reported. In a comment-only workflowgithub.head_refandgithub.event.pull_request.*are empty and are not treated as a head.issuesis not handled: its payload never names a pull request, and text that does is an injection (template-injection).author_associationconditions of the comment, the issue or the pull request count only when they name no association of someone without access (NONE,CONTRIBUTOR,FIRST_TIMER,FIRST_TIME_CONTRIBUTOR,MANNEQUIN):!= 'NONE'and a list withCONTRIBUTORare not gates (this also tightenspull_request_target, which before accepted any mention). Permission actions count when they fail the job:sushichop/action-repository-permission(write/admin, norelax),prince-chrismc/check-actor-permissions-action,lannonbr/repo-permission-check-action,xt0rted/slash-command-action,TheModdingInquisition/actions-team-membership(exitnot false),actions-cool/check-user-permissiononly withrequire: write|adminanderror-if-missing: true(otherwise it only sets an output; CodeQL accepts it always), andactions/github-scriptthat asks for the permission/membership and throws orsetFailed. The gate step must always run (noif:, nocontinue-on-error) and precede the checkout. I did not takeoctokit/request-action(itspermissionroute returns 200 for everybody). Also anenvironment:(as before) and, new, a needed job (transitively) whoseif:is a guard, which has an environment or a gate step, unless the dependent job runsalways()/cancelled()/failure()./test; the docs say so. The TOCTOU PR will report gate + mutable ref (refs/pull/N/head,head_ref,gh pr checkout N).if:is false for the privileged events bygithub.event_name(reusesevalGate) is not judged for them, and the message says "can only read" when the job's token is read-only.Part of #167 (ideas-others item 1 and 10, ideas-github item 4 partly: the
workflow_callpart is the next PR).Tests
TestRuleUntrustedCheckoutComment(about 60 cases: every shape above, each gate and each way it does not count, needs chains, event conditions), goldenstestdata/err/untrusted_checkout_issue_comment.*andtestdata/ok/untrusted_checkout_issue_comment.yaml.go build,go vet,go test ./...andhk check --allpass locally.Corpus
Same 379 repositories / 4650 files (260 files mention
issue_comment), default profile. #183: 6 findings; this branch: 28. First run gave 32 raw new findings; I read each one and fixed four causes of false positives before this version: a jobif:ongithub.event_namethat excludes the comment (argumentcomputer/ix),github.head_refin a comment run (flutter-qiita-client), and jobs thatneeds:a job guarded byauthor_associationor bygithub.event.comment.user.login == github.repository_owner(mlflowui-review/nailaopus,huggingface/transformersself-comment-ci,AlexPerathoner/SlimHUDrelease). The remaining 22 new findings in 17 repositories, all reviewed by reading the workflow: every one is a bot that any commenter can trigger (if:only looks at the comment text such as/test) and that checks out the PR head (19 through an output ofxt0rted/pull-request-comment-branch, 3 throughrefs/pull/<issue number>/head; none throughgh pr checkout,branch-deployor the other actions, so those shapes are only covered by the unit tests) and then runs a build tool; several pass a secret to the checkout or the build (JJSveding,pachli,zamryeng). I found no false positive in them, but two have a job token that is onlycontents: read(guitarrapc/UnityBuildRunner,monocloud), where the impact is lower and the message says so. 3 existing findings only changed their message (read-only token). Nothing disappeared. Not measured: workflows gated by a mechanism that the rule does not know (a custom script that checks the user) would be false positives, none was seen; andissue_commentworkflows in repositories outside the corpus.🤖 Generated with Claude Code
Note
Medium Risk
Changes security lint behavior for a common workflow pattern (many new findings on real repos); logic is complex but well-tested and mostly additive with stricter false-positive controls.
Overview
Extends the
untrusted-checkoutsecurity rule toissue_commentworkflows (e.g./testbots), which run with base-repo secrets but must resolve the PR from the issue number or helper actions.Detection now flags checkouts via
gh pr checkouttied togithub.event.issue.number(including viaenvandGITHUB_ENV),refs/pull/<n>/head|merge, and head outputs from actions likext0rted/pull-request-comment-branch,github/branch-deploy, and similar. Comment-only runs no longer treat emptygithub.head_ref/pull_request.*as a head checkout.Gates are tightened:
author_associationcounts only when it excludes untrusted roles (also affectspull_request_target); recognized permission-check actions must run before checkout; jobsneeds:a gated, environment-protected, or permission-checked upstream job are skipped unlessalways()applies. Jobs/steps whoseif:excludes privileged events viagithub.event_nameare not analyzed for those events.Messaging distinguishes read-only
GITHUB_TOKENjobs andissue_comment-specific wording; docs and zizmor parity tables are updated. Large test/golden coverage plus online test for environments on needed jobs.Reviewed by Cursor Bugbot for commit dc76174. Bugbot is set up for automated code reviews on this repo. Configure here.