A review-verdict/h10 success is repo-global, so a second PR with the same head inherits it #663

Open
opened 2026-07-26 23:28:26 +02:00 by timothy · 0 comments
Owner

Found by the cold review of the #649 PR. Pre-existing — not introduced by that PR, which is why it was filed rather than fixed there.

The gap

A Gitea commit status belongs to a sha in a repository, not to a pull request. review-verdict/h10 is therefore inherited by any PR whose head is that sha.

That is exactly what makes #622's invariant work — a new commit cannot inherit an old verdict, because a new commit is a new sha. The same property read from the other end is a hole:

  1. Open PR A with head H, based on branch B, where the diff H vs B is docs-only. review-verdict.yml posts review-verdict/h10=success on H as a docs-only exemption.
  2. Close PR A.
  3. Open PR B with the same head H, based on main, where the diff H vs main contains unreviewed code.
  4. H already carries review-verdict/h10=success. Branch protection is satisfied.

The workflow's own "already decided for THIS sha" early exit (existing=success → exit 0) reinforces it: the job returns before enumerating files, so it never re-classifies H against the new base.

Relationship to the other two holes in this family

Same family, three different routes — worth stating together because each fix looks complete on its own:

# What moves What holds still Status
#622 the head the verdict closed — per-sha required status
#632 the base the head + the verdict detected on the hook path
this the PR the head + the verdict open

#632's hook check does not cover this: it compares the recorded base against the live base.ref of the PR being merged. Here the second PR's base is main, and the inherited status records whatever base the first PR had — so it would in fact be caught if the first PR's base differed. It is not caught when both PRs target main and the difference is which commits are reachable, nor on any merge path that does not go through the hook.

Exposure

Low, and the reasoning is the same as release.verdict-status-check limitation 4: two-account repo (timothy, renovate), where the documented threat model is a careless change rather than a hostile one. The sequence above is not something anyone does by accident — it takes deliberate PR churn. Filing because the alternative is that this stays known only inside a review transcript.

Options

  1. Have review-verdict.yml include the PR number in the status description and refuse to honour an existing=success whose recorded PR is not this one (re-classify instead of early-exiting). Cheapest; composes with #632's description field.
  2. Drop the existing=success early exit entirely and always re-classify, accepting that the workflow may overwrite a human verdict — probably wrong, that early exit exists for a real reason.
  3. Accept and document under limitation 4, which already concedes that PROTECTED is a guardrail against accidents rather than a tamper-proof control.

(1) is the honest fix and is small. Note it interacts with #632: both want a structured field in the description, so they should agree on one format rather than growing two parsers.

Done-when

  • A decision recorded (fix, or explicit accept-and-document with the reasoning)
  • If fixed: demonstrated on scratch PRs that a status earned on one PR does not satisfy another PR with the same head
  • The description format is shared with #632's (base: …) field, not a second ad-hoc parser
  • docs/decisions/records/release/verdict-status-check.md updated to match the outcome
  • Adversarial review passed
Found by the cold review of the #649 PR. **Pre-existing** — not introduced by that PR, which is why it was filed rather than fixed there. ## The gap A Gitea commit status belongs to a **sha in a repository**, not to a pull request. `review-verdict/h10` is therefore inherited by *any* PR whose head is that sha. That is exactly what makes #622's invariant work — a new commit cannot inherit an old verdict, because a new commit is a new sha. The same property read from the other end is a hole: 1. Open PR **A** with head `H`, based on branch `B`, where the diff `H` vs `B` is docs-only. `review-verdict.yml` posts `review-verdict/h10=success` on `H` as a docs-only exemption. 2. Close PR A. 3. Open PR **B** with the *same* head `H`, based on `main`, where the diff `H` vs `main` contains unreviewed code. 4. `H` already carries `review-verdict/h10=success`. Branch protection is satisfied. The workflow's own "already decided for THIS sha" early exit (`existing=success` → `exit 0`) reinforces it: the job returns before enumerating files, so it never re-classifies `H` against the new base. ## Relationship to the other two holes in this family Same family, three different routes — worth stating together because each fix looks complete on its own: | # | What moves | What holds still | Status | |---|---|---|---| | #622 | the head | the verdict | closed — per-sha required status | | #632 | the base | the head + the verdict | detected on the hook path | | this | the **PR** | the head + the verdict | open | #632's hook check does **not** cover this: it compares the recorded base against the *live* `base.ref` of the PR being merged. Here the second PR's base is `main`, and the inherited status records whatever base the first PR had — so it would in fact be caught *if* the first PR's base differed. It is **not** caught when both PRs target `main` and the difference is which commits are reachable, nor on any merge path that does not go through the hook. ## Exposure Low, and the reasoning is the same as `release.verdict-status-check` limitation 4: two-account repo (`timothy`, `renovate`), where the documented threat model is a careless change rather than a hostile one. The sequence above is not something anyone does by accident — it takes deliberate PR churn. Filing because the alternative is that this stays known only inside a review transcript. ## Options 1. Have `review-verdict.yml` include the PR number in the status `description` and refuse to honour an `existing=success` whose recorded PR is not this one (re-classify instead of early-exiting). Cheapest; composes with #632's description field. 2. Drop the `existing=success` early exit entirely and always re-classify, accepting that the workflow may overwrite a human verdict — probably wrong, that early exit exists for a real reason. 3. Accept and document under limitation 4, which already concedes that `PROTECTED` is a guardrail against accidents rather than a tamper-proof control. (1) is the honest fix and is small. Note it interacts with #632: both want a structured field in the description, so they should agree on one format rather than growing two parsers. ## Done-when - [ ] A decision recorded (fix, or explicit accept-and-document with the reasoning) - [ ] If fixed: demonstrated on scratch PRs that a status earned on one PR does not satisfy another PR with the same head - [ ] The description format is shared with #632's `(base: …)` field, not a second ad-hoc parser - [ ] `docs/decisions/records/release/verdict-status-check.md` updated to match the outcome - [ ] Adversarial review passed
timothy added the ci-cdpriority: lowsecurity labels 2026-07-26 23:28:26 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: timothy/ersatztv#663