review-verdict.yml is head-resolved, so a PR editing it can self-approve the required check #672
Closed
opened 2026-07-27 00:05:43 +02:00 by timothy
·
4 comments
No Branch/Tag Specified
main
renovate/dotnet-monorepo
renovate/meziantou.analyzer-3.x
renovate/lucene.net
renovate/sqlitepclraw.bundle_e_sqlite3-3.x
renovate/cliwrap-3.x
913-scripted-playout-401
release/v26.15.0-notes
issue-806-guard-populations
scratch/767b-poisoned
scratch/767b-control
release/v26.14.0-notes
release/v26.14.0
docs/510-skill-logo-bug-policy
fix/510-watermark-resolution-policy
fix/629-verdict-classifier-falseopens
fix/609-decisions-edit-token-scope
issue-135-clear-to-none
release/v26.12.0-notes
fix/409b-lastscan-api-parity
fix/401-updatechannel-mirror-422
fix/327-playlist-rename-validation
fix/410-scancancel-log-level
fix/409-447-librariesscreen-neverscanned
fix/338-zap-exit-code
fix/367-plex-budget-message
fix/310-debom-legacy-cs
ci/604-lane-rebalance
feat/388-design-mirror
feat/247-test-ownership
feat/247-primary-action
feat/357-player-owned-playback
feat/357-jellyfin-plugin-poc
fix/289-mcp-hardening
issue58-mcp
feat/244-channels-extract
ci/auto-bump-prod-compose
feat/multi-rerun-collections-api
feat/collections-api
feat/quick-wins
feat/185-docs-part2
feat/140-collections-screen
feat/146-channel-edit
feat/147-classic-ui-link
issue22-renovate-dashboard
feat/91-cutover
feat/63-composite-create
feat/65-library-browse
feat/85-epg
feat/86-schedule-editor
feat/109-dashboard-data
feat/99-session-tracking
fix/dockerfile-node-tag
feat/59-spa-foundation
docs/59-ui-redesign-brief
feat/102-json-guide
feat/111-schedule-durations
feat/104-artwork-upload
feat/103-media-sources-api
feat/playouts-read-api
feat/108-health-api
feat/105-picker-list-endpoints
issue-97-channel-state-api
issue42-jellyfin-musicvideos
issue46-rest-api-error-contract
dependabot/nuget/ErsatzTV.FFmpeg.Tests/multi-d307a2e06f
qsv-improvements
hdr-vulkan-cuda-test
v26.16.0
v26.15.0
v26.14.0
v26.13.0
v26.12.0
v26.11.0
v26.10.0
v26.9.0
v26.8.0
v26.7.0
blazor-final
v26.6.0
v26.5.0
v26.4.0
v26.3.1
v26.3.0
v26.2.0
v26.1.1
v26.1.0
v25.9.0
v25.8.0
v25.7.1
v25.7.0
v25.6.0
v25.5.0
v25.4.0
v25.3.1
v25.3.0
v25.2.0
v25.1.0
v0.8.8-beta
v0.8.7-beta
v0.8.6-beta
v0.8.5-beta
v0.8.4-beta
v0.8.3-beta
v0.8.2-beta
v0.8.1-beta
v0.8.0-beta
v0.7.9-beta
v0.7.8-beta
v0.7.7-beta
v0.7.6-beta
v0.7.5-beta
v0.7.4-beta
v0.7.3-beta
v0.7.2-beta
v0.7.1-beta
v0.7.0-beta
v0.6.9-beta
v0.6.8-beta
v0.6.7-beta
v0.6.6-beta
v0.6.5-beta
v0.6.4-beta
v0.6.3-beta
v0.6.2-beta
v0.6.1-beta
v0.6.0-beta
v0.5.8-beta
v0.5.7-beta
v0.5.6-beta
v0.5.5-beta
v0.5.4-beta
v0.5.3-beta
v0.5.2-beta
v0.5.1-beta
v0.5.0-beta
v0.4.5-alpha
v0.4.4-alpha
v0.4.3-alpha
v0.4.2-alpha
v0.4.1-alpha
v0.4.0-alpha
v0.3.8-alpha
v0.3.7-alpha
develop
v0.3.6-alpha
v0.3.5-alpha
v0.3.4-alpha
v0.3.3-alpha
v0.3.2-alpha
v0.3.1-alpha
v0.3.0-alpha
v0.2.5-alpha
v0.2.4-alpha
v0.2.3-alpha
v0.2.2-alpha
v0.2.1-alpha
v0.2.0-alpha
v0.1.5-alpha
v0.1.4-alpha
v0.1.3-alpha
v0.1.2-alpha
v0.1.1-alpha
v0.1.0-alpha
v0.0.62-alpha
v0.0.61-alpha
v0.0.60-alpha
v0.0.59-alpha
v0.0.58-alpha
v0.0.57-alpha
v0.0.56-alpha
v0.0.55-alpha
v0.0.54-alpha
v0.0.53-alpha
v0.0.52-alpha
v0.0.51-alpha
v0.0.50-alpha
v0.0.49-prealpha
v0.0.48-prealpha
v0.0.47-prealpha
v0.0.46-prealpha
v0.0.45-prealpha
v0.0.44-prealpha
v0.0.43-prealpha
v0.0.42-prealpha
v0.0.41-prealpha
v0.0.40-prealpha
v0.0.39-prealpha
v0.0.38-prealpha
v0.0.37-prealpha
v0.0.36-prealpha
v0.0.35-prealpha
v0.0.34-prealpha
v0.0.33-prealpha
v0.0.32-prealpha
v0.0.31-prealpha
v0.0.30-prealpha
v0.0.29-prealpha
v0.0.28-prealpha
v0.0.27-prealpha
v0.0.26-prealpha
v0.0.25-prealpha
v0.0.24-prealpha
v0.0.23-prealpha
v0.0.22-prealpha
v0.0.21-prealpha
v0.0.20-prealpha
v0.0.19-prealpha
v0.0.18-prealpha
v0.0.17-prealpha
v0.0.16-prealpha
v0.0.15-prealpha
v0.0.14-prealpha
v0.0.13-prealpha
v0.0.12-prealpha
v0.0.11-prealpha
v0.0.10-prealpha
v0.0.9-prealpha
v0.0.8-prealpha
v0.0.7-prealpha
v0.0.6-prealpha
v0.0.5-prealpha
v0.0.4-prealpha
v0.0.3-prealpha
v0.0.2-prealpha
v0.0.1-prealpha
Labels
Clear labels
ad-hoc
api
bug
ci-cd
content
dependencies
enhancement
frontend
in-progress
jellyfin
parked
priority: high
priority: low
priority: medium
review
security
One-off / ad-hoc work not tracked by a dedicated issue
REST API / HTTP endpoints
Something isn't working
Build, test, deploy pipeline
Channel content / schedules / playlists
Dependency updates (Renovate)
New feature or improvement
ChicoryTV React SPA frontend
Claimed by an active session — do not pick up
Jellyfin tuner / IPTV integration
Excluded from automatic queue pickup; work only when explicitly selected
Adversarial review finding
Security / vulnerability fix
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: timothy/ersatztv#672
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Found while reviewing the #649 wiring. Not a regression — it predates all of #643/#647/#649 and those changes strictly reduced the surrounding surface. Filing it because the
ci.shared-pr-file-enumerationrecord previously implied it was mitigated, and it is not.The hole
Gitea, like GitHub, resolves a
pull_requestworkflow definition from the PR's own head commit. So a PR that edits.gitea/workflows/review-verdict.ymlruns its own rewritten copy.That copy can simply POST
review-verdict/h10=successfor its head sha and stop. Two things that look like they should prevent it, do not:PROTECTEDdoes not help — the tampered copy also definesPROTECTED.mainrequires the contextreview-verdict/h10to besuccess. It does not care who posted it, and the rule carriesrequired_approvals: 0. A self-postedsuccesssatisfies the requirement outright.The #649 base-ref checkout closes the adjacent hole (a PR rewriting
scripts/pr-changed-files.sh, the script the workflow executes), and abranches: [main]filter closes a third (forging a status via a PR into an attacker-created base branch). Neither touches this one, because the workflow file itself is head-supplied.Why it is currently low-severity
Pushing a branch to this repo requires write access, so the threat model is a compromised contributor, not an anonymous attacker. Someone with write access has other paths. It is worth closing anyway, because the entire H10 mechanism exists to make merge-consent derivable from state rather than assertable — and this is a way to assert it.
Options (not deciding here)
review-verdict/h10whose author is the CI account rather than a reviewer. Needs a second, non-PR-writable actor.required_approvals: 1onmainmeans a forged status alone is insufficient. Cheapest by far; changes the human workflow.workflow_dispatchjob that reads the PR and posts, so its definition comes frommainrather than the head.Done-when
pull_requestworkflow definition from the HEAD — confirmed on this instance (Gitea 1.25.4), scratch PR #693: the head's rewritten copy ran and posted its probe context, and the realreview-verdict/h10was never written at allpull_request_target+branches: [main]. Option 2 (required_approvals: 1) was cheapest but is unusable here: Gitea forbids approving your own PR and this is effectively a single-maintainer repo, so it would deadlock every PR. Option 1 buys nothing without a second identity, since the tampered workflow holds the same token. Cost of the chosen fix: a non-main-based PR gets no status (fail-closed), a retargeted PR stays statusless until its next push, and the gate is no longer exercised by its own PR — documented indocs/ci-cd.mdpull_request_target(base definition ran, postedh10=pending), and PR #695 shows a non-mainbase produces no run at all. This demonstrates the fix for this workflow only — probe #696 shows the bypass still succeeds viadocker-build.yml, which is the residual belowci.shared-pr-file-enumerationupdated to match the resolved state — past-tensed, plusrelease.verdict-status-check(body and itsrule:field) and a new recordci.gate-trigger-base-resolvedceef16081MERGEABLEResidual — deliberately NOT closed here
This fix closes the definition-rewrite route through
review-verdict.yml. It does not close the class: Gitea injects a write-capableGITEA_TOKENinto every job, and branch protection binds the context, not its issuer. Filed as #697. Three further exemption-path defects found during review (retarget race, Renovate-PR hijack, unreclassified inherited success) — none introduced by this fix — are #698.PR #699.
Agreeing with the analysis, and recording the
branches: [main]variant properly rather than leaving it in a passing clause — it was offered to me during #666 and I want the trade-off written down before someone reaches for it as an obvious win.The mechanism it closes. The #666 base-ref checkout rests on "a PR cannot push to its own base branch". That holds for
mainand fails for any attacker-created base: pushevil-basecarrying a tamperedscripts/pr-changed-files.sh, openpayload → evil-base, and the job checks outevil-base, runs the tampered enumeration, and posts a forgedreview-verdict/h10=successonpayload's head sha. Retarget tomainand the never-overwrite guard (existing = success → exit 0) actively preserves it — a guard that is correct in isolation becoming load-bearing in the attacker's favour. That is #663's inheritance property supplying the last step.Why it is not a free fix.
editedis not in this workflow'stypes:, so a PR retargeted intomainfrom another base gets no run and therefore no status at all. Fail-closed, but it stalls silently — an exempt Renovate PR would sit unmergeable with a missing required context and no log explaining why. Addingbranches: [main]without also addingeditedtrades a hostile-actor hole for a routine-operations one, and addingeditedre-opens the question of what happens when the workflow re-runs over an existing verdict.Which is why I think you are right that this issue dominates it. All three (this, the
branches:variant, #663) require write access, and while a head-supplied workflow definition can post its ownsuccess, closing the other two changes nothing about the threat model — they are alternate routes to a door that is already open. Sequencing matters: fix this one first, then re-evaluate whether thebranches:filter is still worth its operational cost, because option 1 in your list (verify the status author from outside the PR's control) closes all three at once and makes the filter redundant rather than merely unnecessary.One correction to my own record while I am here:
ci.shared-pr-file-enumerationsays the base-ref checkout means "a PR cannot supply the code that judges it". That is true of the scripts and false of the workflow, which is exactly your point. I scoped it in the "what is deliberately NOT claimed" paragraph, but the headline sentence still reads stronger than it should. Worth tightening when this is fixed, so the record does not have to be read to the end to avoid being misled.Claiming this — orchestrator session starting 2026-07-28.
Pre-claim checks (per
process.parallel-session-claim): no open PR references #672,git ls-remote --heads origin '*672*'is empty, no prior claiming comment,origin/mainfreshly fetched at036bcfc5a. TheCLAIM?flag fromselect-queue.shresolved to "no claim" — the only existing comment is the filer's own.Closing record
Outcome: Merged via PR #699 (
0c492defa)..gitea/workflows/review-verdict.ymlnow triggers onpull_request_targetwithbranches: [main], so Gitea resolves its definition from the base rather than the PR head. Closes the definition-rewrite route through this workflow — explicitly not the whole class (see Deferred).Root cause: Gitea resolves a
pull_requestworkflow definition from the PR's own head commit. #649's base-ref checkout bound the scripts this job executes to the base, but nothing bound the job definition, so a PR editing the gate ran its own rewritten copy.PROTECTEDcouldn't help (the rewrite defines it too) and branch protection couldn't either — it requires the context, not an issuer, withrequired_approvals: 0.Decisions/conventions changed: new record
ci.gate-trigger-base-resolved. Updated:ci.shared-pr-file-enumeration(its "does NOT mean a PR cannot rewrite the gate" paragraph past-tensed) andrelease.verdict-status-check(item 4 and itsrule:frontmatter, which had gone stale in the round-1 fix — the exact failure mode that record's own archaeology warns about).Reusable knowledge:
pull_request_targetis base-resolved on Gitea 1.25.4, andbranches: [main]is half the fix, not a refinement. Base resolution means the base branch supplies the definition, so without the filter the rewrite just relocates to an attacker-pushed base — and because a commit status is repo-global per sha (#663), asuccessforged there is inherited by a later genuine PR with the same head.pull_request_target's usual danger doesn't transfer here only because this job never checks out or executes head-supplied code. Trigger and base-ref checkout are one decision; a head checkout under this trigger would be strictly worse than the bug.h10, so a test of the gate could never forge the gate.docker-build.yml's credentials, not by reading it. A reasoned audit would have concluded "only this workflow writes the status."docs/ci-cd.md→ Review-verdict gate.Verification: Four scratch PRs on this instance (Gitea 1.25.4), all since deleted — #693 (
pull_requestis head-resolved: head's rewrite ran, realh10never written), #694 (pull_request_targetis base-resolved: base gate ran and postedh10=pending, onopenedandsynchronize, secrets available), #695 (branches: [main]blocks a non-mainbase: no run, no statuses), #696 (the negative result behind #697). New test pins the exact trigger set — an earlier version stayed green whenworkflow_dispatchwas added alongside — plus a guard that no other workflow names the context in executable lines. Nine trigger mutations verified red by an independent reviewer. 340 script tests green; full CI green onceef16081. Three cold reviews across two model families; rounds 1–2 BLOCKED on doc overclaim and residual scope.Deferred: The class is not closed and the docs say so in the record's
rule:field, not just its body. Gitea injects a write-capableGITEA_TOKENinto every job and branch protection binds the context rather than its issuer → #697. Three exemption-path defects found during review, none introduced here → #698. Post-merge live confirmation of the gate is partially complete: probe PR #702 shows the job registers and starts as(pull_request_target)against basemain(so the trigger fires), but the job was killed by runner starvation before posting, so the classify-and-post half rests on #694's evidence rather than amain-based observation.Docs updated:
docs/ci-cd.md(gate section + the ⚠️ "not exercised by its own PR" recipe), newdocs/decisions/records/ci/gate-trigger-base-resolved.md,ci.shared-pr-file-enumeration,release.verdict-status-check, regenerateddocs/decisions/README.md.Correction to the closing record above — post-merge verification is COMPLETE, not partial.
That record said the classify-and-post half rested on #694's scratch-base evidence because the probe job was killed. The job was retried once runners freed up and completed in 5s. On probe PR #702, against base
main, with the merged workflow:That exercises the whole live path end to end: the
pull_request_targettrigger fires with basemain, the base-ref checkout resolves, the jq preflight passes,scripts/pr-changed-files.shenumerates exhaustively from the base tree, the docs-only classification is correct, and the status is written. The earlier 14m44s "failure" was a killed job — missing log file, the documented tell — and not a defect.So the gate is confirmed working on
main. Probe PR #702 closed and its branch deleted; the throwawaydocs/_gate-probe.mdexisted only on that branch and never merged.Worth recording for whoever next changes this workflow: this is exactly the procedure
docs/ci-cd.md→ Review-verdict gate now prescribes, and it was needed precisely because the change could not be verified from its own PR. Three separate job-kill events occurred while landing this (all missing-log signature, one taking 22m onEF migration integrity), so budget for runner contention when running the probe — a killed probe reads exactly like a broken gate if you don't check for the missing log.