Repository navigation
Run image workflows on pull_request instead of pull_request_target - #538
Open
gvozdetsky wants to merge 2 commits into
Open
gvozdetsky wants to merge 2 commits into
gvozdetsky wants to merge 2 commits into
Conversation
added 2 commits
October 26, 2026 16:11
GitHub blocks pull_request_target on public repositories by default
from 2026-12-02. These workflows also ran 'git checkout
${{ github.head_ref }}' in a shell with the Quay credentials or
PERSONAL_ACCESS_TOKEN available, so a branch name could inject commands.
Use build-and-push-v5 of toolforge/github-actions, which checks out the
PR head by SHA and skips pull requests from forks; do the same in
update-container-tags. Fork PRs no longer build images: push the branch
to this repository instead.
It was never read, and it put ${{ github.head_ref }}, a branch name the
PR author chooses, into a shell.
Author
|
The failing |
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.
GitHub blocks
pull_request_targeton public repositories by default from 2026-12-02. It already warns on every image build, e.g. https://github.com/toolforge/paws/actions/runs/40342868756 (Workflow execution policy warning (evaluate mode); see https://docs.github.com/en/actions/reference/security/securely-using-pull_request_target). After that date no PR would buildpr-Nimages or updatepaws/values.yaml.Depends on toolforge/github-actions#6 and on the
build-and-push-v5tag created after it's merged. Don't merge this before the tag exists.pull_requestand usebuild-and-push-v5. That version checks out the PR head by SHA instead of runninggit checkout ${{ github.head_ref }}in a shell, and skips fork PRs.update-container-tags.yaml: triggers onpull_request, skips fork PRs, and checks out the head branch throughactions/checkoutinstead ofgit checkout ${{ github.head_ref }}in a shell. That step ran withPERSONAL_ACCESS_TOKENstored in.git/config, and the workflow has nopathsfilter, so any PR could reach it.notification.yaml: drop the unusedinital_commitline, which also put${{ github.head_ref }}into a shell.What changes for contributors:
pull_requestthey get no secrets. A maintainer pushes such a branch to this repository to get them.pull_requestruns only see Dependabot secrets. For Dependabot PRs that touchimages/(like Bump idna from 3.7 to 3.15 in /images/minesweeper #516), an admin needs to addQUAY_USER,QUAY_PASSWORDandPERSONAL_ACCESS_TOKENas Dependabot secrets.Same change in toolforge/quarry: toolforge/quarry#106.