Skip to content

ci: route fork PRs to hosted runners and pin actions in secret-holding jobs - #296

Merged
avrabe merged 2 commits into
mainfrom
ci/security-hardening
Oct 29, 2026
Merged

avrabe merged 2 commits into
mainfrom
ci/security-hardening

Conversation

@avrabe

@avrabe avrabe commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Security hardening of CI workflows. Admission: security, which the ci-status admission rule always admits.

Route fork PRs to hosted runners

In pull_request-triggered workflows, runs-on uses the warte ci.yml expression: fork PRs go to ubuntu-latest; same-repo PRs and pushes stay on the same self-hosted label as before. Matrix jobs only reroute their self-hosted entries (contains(matrix.runner, 'self-hosted')), so macOS/Windows entries are unchanged. Where a step uses a non-GITHUB_TOKEN secret (codecov uploads), it gets if: ... && github.event.pull_request.head.repo.fork != true. The guard goes on the step, not the job, so no required job is skipped on fork PRs. As the comment in the file says, this routing is a default, not a security boundary: the runner-group policy and fork-PR approval enforce isolation.

Pin actions in secret-holding jobs

Every uses: in a job that references secrets. (including GITHUB_TOKEN) is pinned to a full commit SHA, with the most specific tag that points at the same commit as a trailing comment (annotated tags dereferenced). Branch refs such as dtolnay/rust-toolchain@stable are pinned to the branch's current commit; for dtolnay the branch's action.yml carries the toolchain default, so behaviour is unchanged. This prepares for the org-level SHA-pinning requirement.

Validation

  • actionlint on every changed workflow: no new findings compared with main.
  • Structural YAML diff: the only values that change are runs-on, if and uses, plus the hand edits described above.
  • This PR's own CI runs as a same-repo PR, so it exercises the self-hosted path only. The fork path is checked statically by actionlint.

🤖 Generated with Claude Code

https://claude.ai/code/session_01G5qpB7zvxLvdrvn5YRyj4R

@avrabe
avrabe force-pushed the ci/security-hardening branch from 6656dc5 to 0f09680 Compare October 28, 2026 15:46
avrabe added a commit that referenced this pull request Oct 28, 2026
#296 routes fork PRs to hosted runners with
`runs-on: ${{ fork && 'ubuntu-latest' || fromJSON('["self-hosted",…]') }}`.
The test counted only the literal `[self-hosted, linux, x64,` list, so it
read every gate as "moved back to the hosted queue" (0 of 8). It now counts
either spelling; both name the class.

Negative control: rewriting those jobs to a bare `ubuntu-latest` still fails
the test ("ci.yml has 0 jobs on the self-hosted pool").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019TNtfRjLNhEz82G2ggeeNu
@avrabe

avrabe commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Taking this over, as the maintainer agreed. The failing test jobs (macOS, Ubuntu and coverage) were runner_trust_boundary::the_pr_gates_run_on_the_pool_and_name_a_class. The test counted only the literal runs-on: [self-hosted, linux, x64, list, so it saw 0 of 8 pool jobs once they became fork-routing expressions. The test now counts either spelling, and pointing those jobs at a bare ubuntu-latest still fails it. I rebased onto main (66ee231), and cargo test --workspace exits 0 locally. Every uses: this PR adds is pinned to a full commit SHA.

@avrabe
avrabe force-pushed the ci/security-hardening branch from 0f09680 to 927a129 Compare October 28, 2026 18:54
avrabe and others added 2 commits October 29, 2026 06:30
…g jobs

- route fork PRs to hosted runners
- pin actions in secret-holding jobs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G5qpB7zvxLvdrvn5YRyj4R
#296 routes fork PRs to hosted runners with
`runs-on: ${{ fork && 'ubuntu-latest' || fromJSON('["self-hosted",…]') }}`.
The test counted only the literal `[self-hosted, linux, x64,` list, so it
read every gate as "moved back to the hosted queue" (0 of 8). It now counts
either spelling; both name the class.

Negative control: rewriting those jobs to a bare `ubuntu-latest` still fails
the test ("ci.yml has 0 jobs on the self-hosted pool").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019TNtfRjLNhEz82G2ggeeNu
@avrabe
avrabe force-pushed the ci/security-hardening branch from 927a129 to 0f7dac4 Compare October 29, 2026 05:33
@avrabe
avrabe enabled auto-merge (squash) October 29, 2026 06:53
@avrabe
avrabe merged commit 2d08db9 into main Oct 29, 2026
38 checks passed
@avrabe
avrabe deleted the ci/security-hardening branch October 29, 2026 07:33
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