docs+ci: download fork-comment artifact to runner.temp (CodeQL artifact-poisoning)#146
Merged
Merged
Conversation
c7e8088 to
582af33
Compare
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.
Why
varlock adopted the 1.18
workflow_runfork-comment split (varlock#840) and CodeQL flagged the poster with a criticalactions/artifact-poisoningalert. The recommendedbumpy-comment.yaml(and our dogfood copy) downloads the untrusted artifact into./bumpy-comment— i.e. insideGITHUB_WORKSPACE, alongside the trusted checkout. CodeQL's recommendation is to "extract artifacts to a temporary folder so they cannot override existing files."bumpy's own repo has no CodeQL workflow, so neither the dogfood poster nor the docs template was ever analyzed — varlock (which runs CodeQL Actions analysis) was the first to surface it.
What
docs/github-actions.md— the recommended poster now downloads to${{ runner.temp }}/bumpy-comment(outside the checkout) and reads--body-file "$RUNNER_TEMP/bumpy-comment/comment.md"..github/workflows/bumpy-comment.yaml(dogfood) — same change; dropped the now-moot "download after checkout or it gets wiped" note since temp is outside the workspace.actions/artifact-poisoningquery may flag the step: the temp-dir download addresses its core recommendation, and if a strict variant still flags it, it's a dismissable false positive (body used only as comment text; PR resolved from the trustedworkflow_runevent, never the artifact).The upload side (unprivileged render step) intentionally keeps
./bumpy-comment— only the privileged download moves to temp.Notes
Docs + a dogfood workflow comment/path change. No behavior change to the comment that gets posted. The
runner.temppath is outsideGITHUB_WORKSPACEon hosted runners, so the trusted checkout (read for the pinned bumpy version) is untouched.