Guard CI workflows against fork PRs provisioning infrastructure#191
Merged
Conversation
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>
vladbologa
approved these changes
May 18, 2026
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.
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.repositoryensures these jobs only run for PRs originating from the same repository, not from external forks. This is defensive infrastructure practice for public repositories because: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.
More critically, this prevents a future misconfiguration from becoming a security incident. If someone later changes the trigger from
pull_requesttopull_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.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.