build: require pinned PR head for benchmark comparisons#69841
Open
itsonlylock wants to merge 1 commit into
Open
build: require pinned PR head for benchmark comparisons#69841itsonlylock wants to merge 1 commit into
itsonlylock wants to merge 1 commit into
Conversation
Require benchmark comparison comments to include the current PR head SHA before checking out and running PR code.
itsonlylock
force-pushed
the
fix-benchmark-compare-head-sha-live-rebased
branch
from
July 20, 2026 12:54
375c038 to
68ee50a
Compare
Author
|
Just checking in to see if there’s anything I can clarify for the review. I also updated the CVSS v4.0 vector in the PR description (I had forgotten to set the UI metric, so it defaulted to UI:N). For context, this fix comes from a report submitted through Google’s OSS VRP intake, per this repo’s SECURITY.md. Thanks again for taking a look when you have time. |
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.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
This fixes an approval-to-checkout TOCTOU where an external fork author can cause unreviewed fork-controlled code to execute in Angular's privileged
issue_commentbenchmark workflow after a team member's/benchmark-comparecomment. The workflow is currently triggered by a trusted commenter, but it resolves the PR head SHA at runtime rather than pinning the authorization to the commit the commenter saw.Because the job installs the checked-out fork tree with
pnpm install --frozen-lockfileand does not disable lifecycle scripts, a stale approval can allow attacker-controlledpreinstallcode to execute in the privileged workflow and capture repository secrets delivered to later steps, including the workflow token used by the final comment-update step.The current vulnerable sequence is:
X./benchmark-compare ..., intending to run the benchmark forX.Y.Yin the privileged benchmark workflow.What is the new behavior?
This PR makes benchmark comparison approval commit-bound.
The workflow now requires
/benchmark-comparecomments to include the current PR head SHA:If the command is missing
sha=..., the workflow stops before checkout/install/benchmark execution and posts a ready-to-use confirmation command containing the current PR head SHA.If the command includes a SHA that no longer matches the current PR head, the workflow stops before checkout/install/benchmark execution and posts an updated confirmation command for the new head SHA.
Only when the requested SHA matches the current PR head does the workflow continue to checkout and benchmark execution. This prevents a post-approval PR head update from authorizing an unintended commit.
Does this PR introduce a breaking change?
This changes the benchmark chatops confirmation flow, but it does not affect Angular package APIs or application behavior.
Other information
Expected reviewer-visible behavior:
/benchmark-compare ...comment: workflow posts the exact pinned command to rerun.Threat model
/benchmark-compare.issue_commentjob.CVSS v4.0:
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H/AU:A= 8.9 (High)CVSS v3.1:
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N= 9.3 (Critical)(Updated the CVSS v4.0 vector to correct the User Interaction metric. I had forgotten to set UI, so the calculator defaulted to UI:N.)
Validation
Mitigation rationale
This PR pins
/benchmark-compareapprovals to an explicit commit SHA to close the TOCTOU window.Additional reproduction artifacts, and validation evidence are available upon request.