Repository navigation
ci: keep fork pull requests off privileged runners - #592
Open
walsykerem wants to merge 4 commits into
Open
walsykerem wants to merge 4 commits into
walsykerem wants to merge 4 commits into
Conversation
Self-hosted jobs gated on the dispatch not naming a fork still checked out the default branch, so a same-repo /test run tested main and report-pr-test posted that result onto the pull request commit. The three privileged jobs now check out ref: inputs.pr_head_sha || github.ref, so a same-repo dispatch tests the PR commit while a push run has empty inputs and falls back to the pushed ref. The test job exports the HEAD it checked out, and report-pr-test skips status when that differs from the dispatched commit, so a run of main can no longer be labelled as the PR result. Fork dispatches still skip every privileged job, and fork-checks is still the only job that checks out inputs.pr_head_repo, on a hosted runner. proof/592-privileged-checkout.sh asserts these invariants. Old shape: 20/27, failing on the three missing checkout refs and on the missing tested SHA. Fixed shape: 27/27.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort 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 9482d2b. Configure here.
This branch has not been deployed
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.

A maintainer can comment on a pull request to run the full test suite, including pull requests opened from a fork. That path checked out the fork's head commit on the project's own runners, machines that have passwordless sudo and a Docker Hub login. So anyone who can open a pull request could get code run as root on shared hardware, and the login step put a registry password on disk before the build started. Checkout also left the tree dirty, so a binary planted by one run could survive and run in the next.
The fix splits trust by runner. A new fork-checks job runs only when the dispatch names a repository other than this one, and only on a hosted runner with no secrets, no sudo and no registry login. It checks out the fork commit and runs
make build, so contributors still get a compile signal.The three self-hosted jobs now skip any dispatch that names a fork, and check out this repository at this workflow revision instead of a supplied repository and ref. That puts the Docker Hub login out of reach for fork code. Checkout cleans the tree by default, and the follow-up clean no longer spares
bin/or downloaded binaries, so no build output crosses between runs. The status comment reads whichever job ran.Note
Medium Risk
CI trust-boundary and checkout behavior change: fork PRs lose full privileged test coverage, and status reporting logic must correctly map fork-only vs in-repo dispatches.
Overview
Fork PR test dispatches no longer execute untrusted code on self-hosted runners that have passwordless sudo, Docker Hub credentials, and shared disk state.
A new
fork-checksjob runs only for workflow dispatches naming an external repo: it checks out the fork commit onubuntu-latestand runsmake buildwith no secrets or registry login. Linux, macOS, and e2e jobs are skipped for those dispatches and otherwise check out this repository at the dispatched SHA (not the fork's tree).Privileged jobs record
tested_shaandreport-pr-testvalidates it matches the PR head before posting a status; fork-only runs reportfork-checksresults. Workspace cleaning is stricter—git clean -ffdxno longer preservesbin/or downloaded binaries across shared-runner runs.Reviewed by Cursor Bugbot for commit 76f60e2. Bugbot is set up for automated code reviews on this repo. Configure here.