Skip to content

fix: use trusted sources for fork coverage reports - #16003

Closed
christian-byrne wants to merge 1 commit into
mainfrom
ci/trusted-e2e-coverage-artifacts
Closed

christian-byrne wants to merge 1 commit into
mainfrom
ci/trusted-e2e-coverage-artifacts

Conversation

@christian-byrne

Copy link
Copy Markdown
Contributor
Full context for agent readers

Summary

workflow_run has base-repository credentials, so checkout v7 correctly rejects a fork PR head SHA. This change uses the repository default branch as genhtml source text only for fork-triggered runs. Reusable calls and same-repository runs continue checking out the tested SHA.

Changes

  • What: Select the checkout ref by trust boundary: explicit reusable-workflow SHA first, same-repository workflow_run SHA second, trusted default branch otherwise.
  • Breaking: None.
  • Dependencies: None.

The downloaded LCOV remains authoritative. Its SF:src/... and SF:packages/... source-map paths are merged and validated unchanged. The existing override_branch, override_commit, and override_pr values still attribute uploads to the triggering PR head.

Security

The privileged workflow never opts into unsafe PR checkout and never fetches fork source. Checkout v7 receives an explicit base-repository branch for fork events, which does not match the fork repository, a PR ref, or the fork head SHA rejected by its pwn-request guard.

Overlap with #15339

Current main already contains #15339's three Codecov attribution inputs via #15225. This PR does not duplicate or alter them; it changes only the genhtml checkout ref.

Verification

  • yamllint --config-file .yamllint .github/workflows/ci-tests-e2e-coverage.yaml: pass
  • pnpm dlx oxfmt@0.59.0 --check .github/workflows/ci-tests-e2e-coverage.yaml: pass
  • YAML parse and ref-selection trust matrix: pass
  • git diff --check: pass
  • actionlint: zero new findings versus origin/main; both report the same pre-existing SC2086 and SC2129 notices in unchanged shell blocks

Review focus

For fork reports, the browsable HTML uses trusted default-branch source text. Codecov still maps LCOV to the exact fork head through override_commit; the HTML can show line drift when the fork changes covered source files, but no coverage records or attribution are changed.

@christian-byrne
christian-byrne requested a review from a team August 26, 2026 09:39
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Aug 26, 2026
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 11 minutes.

View limit details

Limit details: You’ve used the included review currently available. Your 95 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 38e30f3b-0b85-4ba0-87d4-c7d9a4f35cfa

📥 Commits

Reviewing files that changed from the base of the PR and between db97eae and 1c98316.

📒 Files selected for processing (1)
  • .github/workflows/ci-tests-e2e-coverage.yaml

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Playwright: ✅ 2011 passed, 0 failed · 1 flaky

📊 Browser Reports
  • chromium: View Report (✅ 1990 / ❌ 0 / ⚠️ 1 / ⏭️ 5)
  • chromium-2x: View Report (✅ 2 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • chromium-0.5x: View Report (✅ 1 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • mobile-chrome: View Report (✅ 18 / ❌ 0 / ⚠️ 0 / ⏭️ 0)

@github-actions github-actions Bot added the risk:R3 PR risk grade (advisory shadow check; grader-owned) label Aug 26, 2026
@codecov

codecov Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##             main   #16003      +/-   ##
==========================================
+ Coverage   80.30%   82.62%   +2.32%     
==========================================
  Files        2271     1941     -330     
  Lines      116734   111718    -5016     
  Branches    33848    32654    -1194     
==========================================
- Hits        93739    92304    -1435     
+ Misses      22489    19073    -3416     
+ Partials      506      341     -165     
Flag Coverage Δ
e2e 66.94% <ø> (-0.02%) ⬇️
unit 74.82% <ø> (ø)
website-unit ?

Flags with carried forward coverage won't be shown. Click here to find out more.
see 340 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@CodeJuggernaut CodeJuggernaut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving - the guard covers exactly the privileged workflow_run leg, and the body already documents the fork-report fidelity trade.

@christian-byrne

Copy link
Copy Markdown
Contributor Author

Superseded by #16404, which fixed the same underlying issue (#16002) and merged 2026-09-01, restructuring this workflow file. Recommend closing this PR rather than rebasing.

Full context

This PR's conflict against main isn't a simple textual conflict — main no longer has the genhtml checkout step this PR modifies. #16404 ("fix: secure fork E2E coverage handoff", merged bdfabd99c3) redesigned .github/workflows/ci-tests-e2e-coverage.yaml end-to-end to close the same pwn-request checkout hole, citing the same issue (Fixes #16002) this PR's body also cites. Issue #16002 is now CLOSED.

Rebasing this PR would require either reinventing a resolution that's already been superseded, or discarding #16404's approach in favor of this one — both are scope decisions beyond a mechanical conflict-resolution rebase, so I'm not pushing a force-with-lease resolution. Filed for Christian to confirm close-vs-supersede.

@christian-byrne

Copy link
Copy Markdown
Contributor Author

Attempted a conflict-resolving rebase onto current main. This PR's entire diff is one line in .github/workflows/ci-tests-e2e-coverage.yaml — the ref: expression on the "Checkout sources for genhtml" step. main's current file (restructured by a later PR that merged sharded coverage) already contains that exact same trusted-source-checkout expression verbatim at the equivalent step (ref: ${{ inputs.source_sha || (github.event.workflow_run.head_repository.full_name == github.repository && github.event.workflow_run.head_sha) || github.event.repository.default_branch }}).

gh pr diff 16003 against current main is empty for the one file this PR touches — the security fix is fully subsumed. Rebasing further would produce a no-op commit. Not enqueuing; the conflict isn't resolvable into a meaningful diff, it's moot. Recommend closing as superseded rather than merging an empty change.

@christian-byrne

Copy link
Copy Markdown
Contributor Author

Independently re-verified dm61-3's finding: this PR's sole change target (the Checkout sources for genhtml step's ref: expression in .github/workflows/ci-tests-e2e-coverage.yaml) no longer exists on main. #16404 (merged 2026-09-01, bdfabd99c3) restructured the entire trusted E2E coverage handoff — the untrusted-checkout step this PR patches was removed outright, replaced by a producer/publisher split where the trusted job only checks out a default-branch PR-resolver action (ref: ${{ github.event.repository.default_branch }}) and never checks out fork source at all. There is nothing left to rebase this fix into; the vulnerability class it addressed is closed by a different, more thorough fix already on main. Recommend closing as superseded by #16404 rather than rebasing.

@christian-byrne

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Rate Limit Exceeded

@christian-byrne have exceeded the limit for the number of chat messages per hour. Please wait 4 minutes and 29 seconds before sending another message.

@huang47 huang47 added the risk:xhigh PR risk grade (advisory shadow check; grader-owned) label Sep 2, 2026 — with ChatGPT Codex Connector
@huang47 huang47 removed the risk:R3 PR risk grade (advisory shadow check; grader-owned) label Sep 2, 2026
@christian-byrne

Copy link
Copy Markdown
Contributor Author

Do not rebase: merged #16404 supersedes this one-line fix. Head left unchanged; not enqueued.

Full context for agent readers

Current main no longer contains the Checkout sources for genhtml step patched here. #16404, merged as bdfabd99c3, replaced it with an unprivileged producer/trusted publisher split and closed the same #16002 vulnerability. Rebasing would require taking main for the sole conflict and leave no meaningful PR diff. Christian disposition is tracked in blocked-on-christian #225.

The program bookkeeping push was not attempted further after two mandatory lock-acquisition timeouts; the exact blocked row was handed to the fleet commander.

@christian-byrne

Copy link
Copy Markdown
Contributor Author

Closing: superseded by #16404 (merged 2026-09-01, bdfabd99c3), which redesigned ci-tests-e2e-coverage.yaml and fixed #16002 end to end. Nothing from this diff is left to carry.

Full context for agent readers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:xhigh PR risk grade (advisory shadow check; grader-owned) size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix fork checkout failure in E2E coverage workflow_run

5 participants