Fix check_task workflow failing on fork PRs - #2941
Merged
Merged
Conversation
…kout guard) actions/checkout now refuses to check out a fork PR's head commit inside a pull_request_target workflow unless explicitly opted in, since that combination (untrusted code + base-repo secrets/token) is the classic "pwn request" pattern. This broke check_task.yml for every fork PR (e.g. #2940). Split the workflow: the two jobs that don't need secrets (check-affected-files, check-pr-description) move to plain pull_request, which is inherently safe for fork code. The Canvas-updating job needs base-repo secrets so it stays on pull_request_target in its own file (check_task_canvas.yml) and explicitly opts in to the fork checkout, since it only reads the checked-out README and never executes anything from the fork's commit.
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.
Summary
check_task.ymlruns onpull_request_targetand checks out the PR's fork commit (github.event.pull_request.head.sha).actions/checkoutnow blocks that combination by default (checking out untrusted fork code into a privilegedpull_request_targetcontext is the "pwn request" pattern), which breaks the workflow for every fork PR — e.g. Scientific paper proposal: An Empirical Evaluation of Using Large Language Models for Automated Unit Test Generation, week 2 #2940.check-affected-filesandcheck-pr-description(no secrets used) move to plainpull_request, which is safe for fork code by design.check-canvasneedssecrets.CANVAS_TOKEN/GH_TOKENto update grading, so it must stay privileged. Moved it to its own workflow file (check_task_canvas.yml) onpull_request_target, withallow-unsafe-pr-checkout: trueexplicitly set — safe here since the job only reads the checked-out README to diff it and never executes anything from the fork's commit.