Research-3539: Producer pinning and upload-job wait for external checks in Required Checks Aggregator¶
Question¶
How can Required Checks Aggregator (.github/workflows/required-aggregator.yml) accept per-SHA code-scanning check runs that GitHub Advanced Security created before a ready_for_review re-run on an unchanged commit, without letting unrelated GitHub Apps satisfy or mask required contexts or letting an older code-scanning pass finish polling before a newly completed SARIF upload reports a failure?
Sources¶
- CI run
43085402627on pull request 3047 at head80595f3baaa80bdb423550eee237b1d6d279e746(observed 2026-11-11):ready_for_reviewre-run after a draft toggle with no intervening commit. - GitHub REST API check-runs listing (
GET /repos/{owner}/{repo}/commits/{ref}/check-runs) measured on pull request head76357c67f(2026-11-12): producer slugs across required and non-required check runs. .github/workflows/security-scans.ymlin this repository: job definitions and SARIF upload steps forSemgrep,CodeQL (C/C++),CodeQL (Python),CodeQL (Actions)andGitleaks.github/codeql-actionanalyzeaction definition:github/codeql-action/analyzedefaults toupload: true(always), uploading SARIF to GitHub code scanning unless explicitly disabled, whereas external scanners upload throughgithub/codeql-action/upload-sarif..github/workflows/required-aggregator.yml,scripts/ci/required_aggregator_harness.pyandscripts/ci/tests/test_aggregator_event_scope.pyin this repository.
Findings¶
-
Incident on an unchanged pull-request head. On 2026-11-11, pull request 3047 at commit
80595f3baaa80bdb423550eee237b1d6d279e746was converted to draft at2026-11-11T18:15:21Zand markedready_for_reviewat19:14:50Zwith no push between the two events. Every pull-request workflow re-ran onready_for_review, creating aggregator run43085402627at19:14:54Z(minCreatedMs=19:12:54Z).github-advanced-securityhad already postedcompleted/successcheck runs on that SHA (gitleaksat00:51:07Z,CodeQLat00:51:23Z,Semgrep OSSat00:54:56Z) and does not create new check runs when an identical SARIF analysis is uploaded again for the same SHA. BecausenewestByNamedropped every check run older thanminCreatedMs, all three owed contexts disappeared frombyNameand failed withnever reported on SHA 80595f3baaa80bdb423550eee237b1d6d279e746 (owed context, ADR-3293). -
Check-run producers and SARIF upload jobs. Querying check runs on pull request head
76357c67fand inspecting.github/workflows/security-scans.ymlestablishes the full set of non-Actions check-run producers and the GitHub Actions jobs that upload SARIF to code scanning on pull requests:
| External app slug | Check-run name(s) | In required (pullRequestOnly) | Uploading Actions job(s) in security-scans.yml | Upload step |
|---|---|---|---|---|
github-advanced-security | CodeQL | Yes (Yes) | CodeQL (C/C++), CodeQL (Python), CodeQL (Actions) | github/codeql-action/analyze (default upload: always, security-events: write) |
github-advanced-security | Semgrep OSS | Yes (Yes) | Semgrep | github/codeql-action/upload-sarif (category: semgrep-local, security-events: write) |
github-advanced-security | gitleaks | Yes (Yes) | Gitleaks | github/codeql-action/upload-sarif (category: gitleaks, security-events: write) |
codacy-production | Non-required analysis check | No | None | External service webhook |
coderabbitai | Non-required review check | No | None | External service webhook |
sourcery-ai | Non-required review check | No | None | External service webhook |
-
Producer pinning blocks cross-app spoofing and name collisions. Exempting every non-
github-actionscheck run fromminCreatedMswithout checking which app owns which name leaves two gaps: any installed GitHub App could post a check run under a required name (CodeQLor agithub-actionsgate name) and satisfy it, or a newer foreign check run could overwrite a realgithub-actionsfailure innewestByName. PinningCodeQL,Semgrep OSSandgitleakstogithub-advanced-securityinexpectedAppByCheckand pinning every other name togithub-actionsensures each check run counts only from its expected producer. Check runs missingapp.slugremain admitted insideminCreatedMsonly forgithub-actionsnames (preserving fail-closed age filtering) and are rejected ongithub-advanced-securitynames. Collecting ignored foreign-producer names in aSetand logging once after polling keeps log output bounded. -
Upload-job propagation wait closes the stale-pass race. When
security-scans.ymlre-runs on a commit that already carries an oldergithub-advanced-securitysuccesscheck run,byNameis populated on the first poll even whileCodeQL (C/C++),CodeQL (Python),CodeQL (Actions),SemgreporGitleaksis still running or has just uploaded a new SARIF file. GeneralisingdelayedRegistrationStillExpected(dependencies, name, nowMs)and polling while any owed external check has an upload job inexternalCheckUploadJobsthat is active or completed withinregistrationPropagationMs(two minutes) holds the aggregator across the upload-to-check-run handoff without duplicating the dependency loop.
Alternatives explored¶
- Drop the
minCreatedMswindow entirely: Rejected. Stale draft-eragithub-actionscheck runs on an unchanged SHA would remain eligible and could satisfy or mask newly triggered pull-request jobs before they register. - Require a freshness window on external check runs: Rejected.
github-advanced-securityposts per-SHA check runs once when analysis results are unchanged, so any recency cutoff re-introduces the pull request 3047 failure onready_for_review. - Accept any non-
github-actionsapp slug without producer pin or upload wait: Rejected. Permits unrelated apps to collide with required check names and lets an older code-scanningsuccessexit polling during the propagation gap right after a SARIF upload job completes. - Producer pin (
expectedAppByCheck) plus SARIF upload-job wait (externalCheckUploadJobs): Chosen.
Open questions¶
- If
github-advanced-securityposts a new check run more thanregistrationPropagationMs(two minutes) after its SARIF upload job completes and an older check run for that name already exists on the SHA, the aggregator will have exited on the older run. Raising the propagation window would add two-plus minutes to every clean draft-to-ready re-run where code scanning intentionally posts nothing new.