Skip to content

Guard CI workflows against fork PRs provisioning infrastructure#191

Merged
mclasmeier merged 1 commit into
mainfrom
mc/event-guards
May 18, 2026
Merged

Guard CI workflows against fork PRs provisioning infrastructure#191
mclasmeier merged 1 commit into
mainfrom
mc/event-guards

Conversation

@mclasmeier
Copy link
Copy Markdown
Collaborator

Part of #190

Add fork-origin checks to all jobs in pr.yml and docker-build.yml that depend on repository secrets or provision real infrastructure (GKE and OpenShift clusters via infractl).

The guard github.event.pull_request.head.repo.full_name == github.repository ensures these jobs only run for PRs originating from the same repository, not from external forks. This is defensive infrastructure practice for public repositories because:

  1. GitHub withholds repository secrets from fork PRs by design, so secret-dependent jobs (registry login, infra token auth, GCP SA) would fail anyway — but they fail late, after consuming CI minutes and producing confusing check statuses.

  2. More critically, this prevents a future misconfiguration from becoming a security incident. If someone later changes the trigger from pull_request to pull_request_target (a common "fix" for the fork-secrets problem), the guard still blocks fork PRs from accessing INFRA_CI_TOKEN, ROXIE_CI_AUTOMATION_GCP_SA, and the ability to provision or delete GKE/OpenShift clusters on internal infrastructure.

  3. Without the guard, fork PRs can trigger cluster creation attempts that fail with opaque auth errors, wasting time for both the contributor and reviewers trying to interpret the CI results.

For docker-build.yml, the guard additionally allows push events (tag and branch pushes) to pass through unconditionally, since those are not subject to the fork-PR threat model.

Add fork-origin checks to all jobs in pr.yml and docker-build.yml that
depend on repository secrets or provision real infrastructure (GKE and
OpenShift clusters via infractl).

The guard `github.event.pull_request.head.repo.full_name == github.repository`
ensures these jobs only run for PRs originating from the same repository,
not from external forks. This is defensive infrastructure practice for
public repositories because:

1. GitHub withholds repository secrets from fork PRs by design, so
   secret-dependent jobs (registry login, infra token auth, GCP SA)
   would fail anyway — but they fail late, after consuming CI minutes
   and producing confusing check statuses.

2. More critically, this prevents a future misconfiguration from becoming
   a security incident. If someone later changes the trigger from
   `pull_request` to `pull_request_target` (a common "fix" for the
   fork-secrets problem), the guard still blocks fork PRs from accessing
   INFRA_CI_TOKEN, ROXIE_CI_AUTOMATION_GCP_SA, and the ability to
   provision or delete GKE/OpenShift clusters on internal infrastructure.

3. Without the guard, fork PRs can trigger cluster creation attempts
   that fail with opaque auth errors, wasting time for both the
   contributor and reviewers trying to interpret the CI results.

For docker-build.yml, the guard additionally allows push events (tag
and branch pushes) to pass through unconditionally, since those are
not subject to the fork-PR threat model.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mclasmeier mclasmeier requested review from porridge and vladbologa May 18, 2026 11:30
Comment thread .github/workflows/docker-build.yml
@mclasmeier mclasmeier merged commit 7544c5b into main May 18, 2026
11 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.

2 participants