Repository navigation
ci: download the validation artifact with the first-party action - #564
Open
WAHIB-EL-KHADIRI wants to merge 1 commit into
Open
WAHIB-EL-KHADIRI wants to merge 1 commit into
WAHIB-EL-KHADIRI wants to merge 1 commit into
Conversation
The PR-comment job runs in the privileged workflow_run context with pull-requests: write, and pulled the artifact with dawidd6/action-download-artifact@v4. That range is covered by GHSA-5xr6-xhww-33m4 (artifact poisoning, fixed in 6). actions/download-artifact@v4 fetches the same artifact by run-id, so the third-party dependency goes away instead of being bumped. It needs actions: read to resolve the run. The artifact is produced by a job that runs on pull_request, so its contents are controlled by the PR author. pr/NR is now reduced to digits before it reaches sticky-pull-request-comment, and an entry that carries no digits fails the job rather than selecting an unrelated PR. set-output is deprecated; the step writes to $GITHUB_OUTPUT. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Author
|
Not chasing a review — just noting that |
Author
|
Following up on my own note above: the run did get approved in the end — |
This branch has not been deployed
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.
What's wrong
episode-validation-comment.ymlruns onworkflow_run. That is the privileged context: it runs frommaster, it holdspull-requests: write, and it runs after a workflow triggered by a pull request — including one from a fork.It downloaded the artifact with
dawidd6/action-download-artifact@v4. That version range is covered by GHSA-5xr6-xhww-33m4 — artifact poisoning, high severity, fixed in6.The producing job matters here.
validate-episode.ymlruns onpull_requestand checks out the merge ref, so.github/scripts/validate-episode-markdown.shand thesetup-node-pnpm-installcomposite action both come from the PR head. A fork PR therefore decides what ends up inpr/NRandpr/validation-report.md. Downstream,number=$(cat pr/NR)was passed straight tosticky-pull-request-comment, so that value chooses which PR gets commented on.The fix
actions/download-artifact@v4fetches the same artifact byrun-id, so the third-party action is removed rather than bumped. This needsactions: readto resolve the run.pr/NRis reduced to digits before use, and an entry with no digits fails the job instead of selecting an unrelated PR.::set-outputis deprecated; the step writes to$GITHUB_OUTPUT.No behaviour change on a normal PR: the same artifact is downloaded, the same comment is posted on the same PR.
What I checked
actions/download-artifact@v4supports cross-run downloads viarun-id+github-token, which is whyactions: readis added and theworkflow:input is dropped.sticky-pull-request-commentstill findspr/validation-report.md.awesome-moroccowhile I was here. This is the only one that combines a privileged trigger with an artifact from an unprivileged job — the rest arepush/schedule/pull_requestonly.I could not execute the workflow end-to-end, since
workflow_runonly fires from the base repository. Worth a maintainer confirming the first run posts a comment as before.AI disclosure: I used an AI coding agent while preparing this change. The advisory range, the trigger analysis, and the artifact data-flow above are things I verified myself against the repository and the GitHub Advisory Database.