fix(ci): prevent command injection via head_ref in benchmark-trigger - #223
Merged
Merged
Conversation
paulinebm
pushed a commit
that referenced
this pull request
Sep 22, 2026
steps.pr.outputs.head_ref (the PR branch name, attacker-controlled) was
interpolated directly into a run: shell block via ${{ }}, which expands
before the shell parses the line. A branch name like
$(cmd) is a valid git ref and would execute arbitrary commands on the
ubuntu-latest trigger runner with the job's GITHUB_TOKEN (actions:write,
checks:write).
Move all steps.*.outputs values used in these run blocks into env: and
reference them as shell variables instead, closing the same injection
pattern for head_sha, pr_number, and check_run_id for consistency.
assafvayner
force-pushed
the
assaf/fix-benchmark-trigger-cmd-injection
branch
from
September 22, 2026 08:17
5e563ea to
e58614d
Compare
Michellehbn
approved these changes
Sep 22, 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.
Fixes a command injection in
benchmark-trigger.yml:steps.pr.outputs.head_ref(the PR branch name, fully attacker-controlled by whoever opens the PR) was interpolated directly into arun:shell block via${{ }}. That expansion happens before the shell parses the line, and a branch name like$(cmd)is a valid git ref, so any member/owner/collaborator commenting/benchmarkon a malicious PR would trigger arbitrary command execution on the trigger job'subuntu-latestrunner with itsGITHUB_TOKEN(actions:write,checks:write).head_refinto anenv:var and reference it as"$HEAD_REF"in the shell.head_sha,pr_number, andcheck_run_idin the same tworun:blocks for consistency, since they're the same interpolation pattern even though their values aren't attacker-controlled today.No behavior change — same commands, same values, just no
${{ }}insiderun:.