Skip to content

🏗️🔧:keep the branch under review off the runner - #1820

Merged
openinf-commit-queue[bot] merged 1 commit into
livefrom
fix/no-pr-content-on-the-runner
Aug 15, 2026
Merged

🏗️🔧:keep the branch under review off the runner#1820
openinf-commit-queue[bot] merged 1 commit into
livefrom
fix/no-pr-content-on-the-runner

Conversation

@DerekNonGeneric

Copy link
Copy Markdown
Member

From the semgrep audit finding on commit-queue.yml:40.

The finding's literal claim is wrong

The rule says the workflow "checks out code from the incoming pull request". It does not — the ref was github.event.pull_request.base.ref, the base branch. Reading the rule shows why it fired anyway:

- pattern: |
    uses: "$ACTION"
    with:
      ref: $EXPR
- metavariable-pattern:
    metavariable: $EXPR
    pattern-either:
      - pattern: github.event.pull_request ...
      - pattern: github.head_ref ...

github.event.pull_request ... matches any continuation, so .base.ref and .head.ref are the same to it.

It was still worth acting on

The workflow fetched the branch under review — git fetch origin pull/N/head — so its commit messages could be read. That put a stranger's objects on a runner holding credentials that can write to this repository, with nothing preventing a later step from executing them except a comment saying not to. Comments do not enforce anything, and the next person to add a build step here would not necessarily read it.

So the mechanism is gone rather than the warning silenced:

  • Commit messages come from the APIGET /pulls/{n}/commits returns them oldest first, merges filtered out — so nothing from the branch reaches the runner at all.
  • No ref: on the checkout. For this event the default is already the base branch, and naming it explicitly was indistinguishable, to a reader and to a scanner, from naming the wrong one.
  • No fetch-depth: 0, since no range is computed locally any more.
  • persist-credentials: false, because nothing here pushes and a token in .git/config is one more thing to pick up.

The rule's precondition no longer holds — there is no actions/checkout with a ref — so the finding clears legitimately rather than by suppression.

Verification

  • nps test — 16/16 tasks, 63/63 tests
  • The only remaining mention of ref: in the workflow is in a comment explaining its absence
  • The lander's message composition is unchanged; only where the messages come from has changed

A semgrep audit rule flagged this workflow for checking out code from
the incoming pull request. It does not: the ref was
`github.event.pull_request.base.ref`, the base branch. The rule matches
any ref beginning `github.event.pull_request`, so it cannot tell the
base from the head.

The finding was still worth acting on. The branch under review was
fetched so its commit messages could be read, which put a stranger's
objects on a runner holding credentials that can write here, with
nothing but a comment to stop a later step executing them. Those
messages now come from the API, so nothing of the branch arrives at all,
and the checkout takes the default rather than naming a ref that reads
like the wrong one.

The token is no longer left in .git/config either. Nothing here pushes.

Signed-off-by: Derek Lewis <DerekNonGeneric@inf.is>
Assisted-by: Claude-Code:claude-opus-5
@netlify

netlify Bot commented Aug 15, 2026

Copy link
Copy Markdown

Deploy Preview for gh-pages-openinf ready!

Name Link
🔨 Latest commit 3b49c18
🔍 Latest deploy log https://app.netlify.com/projects/gh-pages-openinf/deploys/6a7ff0836bccf9000847a4e5
😎 Deploy Preview https://deploy-preview-1820--gh-pages-openinf.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@DerekNonGeneric DerekNonGeneric added the commit-queue Land this pull request when its checks pass label Aug 15, 2026
@openinf-commit-queue
openinf-commit-queue Bot merged commit 5836ce6 into live Aug 15, 2026
15 checks passed
@openinf-commit-queue openinf-commit-queue Bot removed the commit-queue Land this pull request when its checks pass label Aug 15, 2026
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.

1 participant