Skip to content

ci(security): skip self-hosted runner jobs for fork PRs - #34

Merged
joeblau merged 1 commit into
mainfrom
security/self-hosted-fork-guard
Oct 20, 2026
Merged

joeblau merged 1 commit into
mainfrom
security/self-hosted-fork-guard

Conversation

@joeblau

@joeblau joeblau commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Security: keep fork PRs off the self-hosted Mac mini runner

This repo is public, and its pull_request workflows run on [self-hosted, macOS, ARM64]. Once a fork PR is approved to run (or comes from a past contributor), it can execute arbitrary code on the Mac mini. That runner also serves private deploy workflows that hold Cloudflare, Fly and npm-class secrets. (GitHub guidance)

Change: every self-hosted job in a PR-triggered workflow gets a job-level guard:

# Security: never run fork PR code on the self-hosted runner.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository

Existing if: conditions are kept and combined with &&. Pushes, workflow_dispatch, schedules and same-repo PRs behave exactly as before. Fork PRs see these jobs as skipped, so a maintainer has to re-run them from a branch in this repo.

Verification: actionlint is clean before and after. A YAML parse plus a script check confirms no self-hosted job in a PR-triggered workflow is left unguarded.

Still manual (org setting): restrict the self-hosted runner group to private repos and require approval for all outside-collaborator fork PRs. This PR doesn't change org settings.

Tooling: workflow edits were made with Codex CLI. Draft: please review.

Public repo PR workflows run on the self-hosted Mac mini. Add a job-level
head.repo.full_name == github.repository guard so fork PR code never runs
there. Same-repo PRs, pushes and dispatches are unchanged.

Edits made with Codex CLI.
@joeblau
joeblau marked this pull request as ready for review October 20, 2026 22:18
@joeblau
joeblau merged commit c102dc3 into main Oct 20, 2026
5 checks passed
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