fix(ci): supply-chain-audit two-dot diff causes false positives on stale-branch PRs - #30621
Merged
Conversation
…s on stale-branch PRs The workflow diffs base.sha..head.sha (two-dot), which compares the tip-of-main tree directly against the PR tip. When files land on main after a PR branched off, they appear in the diff even though the PR never touched them — triggering false-positive findings. Example: PR #30609 was flagged for hermes_cli/setup.py, a file added to main by an unrelated commit after the PR branched. Switch to three-dot diff (base.sha...head.sha), which diffs from the merge base to the PR tip — only changes introduced by this PR are included. Applied to all four diff commands in both jobs (scan and dep-bounds).
Contributor
🔎 Lint report:
|
Collaborator
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 does this PR do?
The supply-chain-audit workflow uses
git diff "$BASE".."$HEAD"(two-dot), which compares the tip-of-main tree directly against the PR tip. When files land on main after a PR branched off, they appear in the diff even though the PR never touched them — triggering false-positive CRITICAL findings.Example: PR #30609 was flagged for
hermes_cli/setup.py, a file added to main by an unrelated commit after that PR branched. The PR itself never touchedsetup.py.Switches all four diff commands to three-dot syntax (
"$BASE"..."$HEAD"), which diffs from the merge base to the PR tip — only changes actually introduced by the PR are included.Related Issue
N/A — discovered via a real false positive on PR #30609.
Type of Change
Changes Made
.github/workflows/supply-chain-audit.ymlline 50:"$BASE".."$HEAD"→"$BASE"..."$HEAD"(content diff inscanjob).github/workflows/supply-chain-audit.ymlline 57: same fix (.pthfile-name check).github/workflows/supply-chain-audit.ymlline 100: same fix (install-hook file-name check).github/workflows/supply-chain-audit.ymlline 161: same fix (dep-boundsjob pyproject.toml diff)How to Test
hermes_cli/setup.pywas addedsetup.pyas an install-hook finding.pthfile orbase64+execcombo still correctly triggers the scannerAlternatively:
git diff A..Bvsgit diff A...Bon any branch pair where main has moved past the merge base — the two-dot diff will show spurious changes from main, the three-dot diff will not.Checklist
Code
fix(scope):,feat(scope):, etc.)Documentation & Housekeeping
cli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/Acloses #23592
closes #13411
both did the same fix, but didn't catch the pyproject.toml one.
Infographic