Repository navigation
🐛 fix(automerge): require verified trusted-author commits for the pin-only exception - #16400
Conversation
…-only exception The human_merge_pin_only exception waived the human-merge-path hold on the PR author login alone. That login records who opened the PR; any principal with write access can push onto the branch afterwards, so a pin-shaped commit from someone else rode a trusted author's PR past the gate. Every commit behind the head must now be authored by a trusted_authors login and carry a GitHub-verified signature, and the list must end at the head. The commit list is read only once the diff already qualifies. Refs #16399 (upstream action-SHA reachability check remains) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: sec-check <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
There was a problem hiding this comment.
Intent alignment (head ac4758a): the code change implements the first checkbox of #16399 faithfully — pinOnlyCommitsTrusted (src/pkg/github/automerge/automerge_human_paths.go:135-183) lists commits paginated with a page cap, fails closed on error/empty/not-ending-at-head, and requires a trusted_authors login plus verification.verified per commit; it runs only after ClassifyPinOnly accepts (:111-117), and both the sweep (:214) and /approve (pr_approve_command.go:93) go through the same helper. Tests cover each refusal and the no-extra-call property.
Gap: the PR body says Fixes #16399 while stating the issue's second checkbox (anchoring a replaced action-sha to the upstream action's own refs — the fork-network pin problem) "is not in this PR". Merging closes #16399 with that remediation neither implemented nor tracked anywhere; the only trace is the prose "does not yet anchor…" added to src/docs/hive-merge.md:223-226, which cites no issue. The issue's Impact section relies on both checks together ("one pin-shaped line swap lands attacker-controlled workflow code").
Requested change: open a follow-up issue for the action-sha upstream-reachability check (ClassifyPinOnly returning the accepted (owner/repo, newSHA, versionComment) triples + tag/compare resolution, as specified in #16399) and cite it in the PR body and in the hive-merge.md:223-226 sentence, so closing #16399 does not drop the second half of the finding.
— hive: agent=adjudicator-3 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. Hive filed review findings that do not block this PR as backlog items:
Cap: 10 backlog item(s) per PR per day. Review findings from Security perspective — read at head
Requested change: also check the committer. Require Merge-time TOCTOU is already covered — the sweep merges the evaluated head ( Review findings from Correctness (read at head ac4758a) Verified signature does not bind the author login — the spoof this PR says it closes is still open. Fix (concrete): in the per-commit loop also require the committer to be the party the signature vouches for — Everything else in the gate reads fail-closed as described (empty/unreadable/truncated list, head not last, unknown login, no-extra-call ordering at Review findings from Conclusion: the code is correct and I would land it, but it conflicts with open #16394, which edits the same helper ( Why #16400 is the one to keep (verified by reading both diffs):
Correctness read (tree + callers):
Minor, not blocking: I have not closed or approved anything. Evidence bundle `#16400c044702` sha256:7cedf1b3d703d043622467167fe6d978dd321aa71c008381f01a841ddedead4a — download from the dashboard or `hivectl review evidence #16400`. |
…ot the author GitHub verifies a signature against the committer's email only, so a verified commit whose author login is in trusted_authors still proves nothing about the author: a write-access principal with their own signing key can author a commit as a bot's noreply address, commit and sign it as themselves, and GitHub reports author.login=<bot>, verified=true. The pin-only exception now also requires each commit's committer login to be web-flow (GitHub created and signed it, so GitHub set the author) or a trusted_authors login (a human trusted author signing locally). Dependabot/Renovate commits and locally signed trusted-author commits still qualify. Fixtures carry a committer; both the sweep and /approve tests gain a trusted-author/foreign-committer/verified case that is held, and the sweep test covers a missing committer and a trusted local committer. Docs, operator reference, changelog fragment and the PinOnlyException type comment describe the committer requirement; hive-merge.md cites the open action-sha anchoring item of #16399. Hive-Fix-Attempt: 1/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Decision needed: @clubanderson should decide whether #16400 (verified signature + committer web-flow-or-trusted) or #16394 (author and committer both in trusted_authors, no signature check) is the commit-provenance rule for the pin-only exception; both edit humanMergePinOnlyExempt and cannot merge together.
Conclusion: the code is correct as far as I can verify, but it conflicts with open #16394, which rewrites the same function (src/pkg/github/automerge/automerge_human_paths.go, humanMergePinOnlyExempt) with a different trust rule. A maintainer has to pick one; I have not closed anything.
How the two differ (read both diffs in full):
| #16400 (this PR) | #16394 | |
|---|---|---|
| commit author | in trusted_authors |
in trusted_authors |
| committer | web-flow or trusted_authors (pinOnlyTrustedCommitter) |
must be in trusted_authors |
| signature | commit.verification.verified required |
not checked |
| completeness | list must end at pr.head.sha |
count must equal pr.commits |
| runs after classifier? | yes — no API call on a held diff | no — commit list fetched before ClassifyPinOnly |
Consequence: under #16394 a Dependabot/Renovate PR has committer web-flow, which is not in trusted_authors, so the exception would hold the very PRs it exists to admit unless an operator adds web-flow to trusted_authors — and that would also make web-flow an accepted PR author. #16400 admits those commits only when GitHub also reports the signature verified, which is the same binding the repo already relies on in src/pkg/github/pr_merge_state.go:112-126 (CommitByHive, #15182/#15421: a web-flow committer login alone is spoofable from an email; the verified signature is what proves GitHub created it). On that basis #16400 looks like the one that should survive, with #16394 closed in its favour — but that is a trust-policy call, hence the routing above.
What I verified in this PR:
pinOnlyCommitsTrusted(automerge_human_paths.go:150-192) fails closed on every branch: listing error, >3 pages, empty list, last SHA ≠ head, missing author/committer login, unverified signature. GitHub'spulls/{n}/commitsis oldest-first, so the last-equals-head check is a valid "list reaches the current head" test.- The commit list is only fetched after
ClassifyPinOnlyaccepts the diff (automerge_human_paths.go:111-117), so held PRs cost no extra call, as the body claims;wantCommitHitsin the test asserts this. /approveand the sweep still share the helper (pr_approve_command.go:93).- Tests cover foreign committer on a verified commit, missing committer login, locally-signed trusted author, truncated list, empty list, 502 — the fixtures match the behaviours claimed.
One operator-facing note (not a defect): a self-hosted Renovate that pushes with plain git (committer renovate[bot], unsigned) will now be held by this exception, which is the intended fail-closed behaviour but worth a line in src/docs/hive-merge.md so operators aren't surprised.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Needs a decision, not a merge:
Head: verdict requires_human @197484b, 67/67 checks green, DCO yes, soak 0s of 10m0s. What to do: approve this head ( How to release it:
Clear the cause and the hive re-evaluates on its next pass; the stage moves to |
|
Needs a decision, not a merge:
Head: verdict requires_human @197484b, 67/67 checks green, DCO yes, soak 4m0s of 10m0s. What to do: approve this head ( How to release it:
Clear the cause and the hive re-evaluates on its next pass; the stage moves to |
clubanderson
left a comment
There was a problem hiding this comment.
Owner decision for reviewed head 197484b: choose this implementation over #16394. Require a trusted PR opener and trusted commit authors, GitHub-verified signatures, an allowed committer (web-flow only in the committer role, or an explicitly trusted login), and a commit list reaching the reviewed head. Null/unmapped accounts and unsigned commits remain held; do not infer trust from editable Git names/emails or add web-flow to trusted_authors. Legitimate producers must fix their mapping/signing or use the human path. This decision does not waive CI, native review, other holds, or upstream-reference review. Keep #16399 open for its remaining upstream-reference work. The relay in #16398 must enforce the same proof before it can land.
|
LGTM label has been added. DetailsGit tree hash: 9eff76c4c705eed322da7c83966d27bd7be86c9a |
1 similar comment
|
LGTM label has been added. DetailsGit tree hash: 9eff76c4c705eed322da7c83966d27bd7be86c9a |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: clubanderson The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
New changes are detected. LGTM label has been removed. |
There was a problem hiding this comment.
Read the diff against v5 at cff2ec2 plus both callers of humanMergePinOnlyExempt (automerge_human_paths.go:235, pr_approve_command.go:93). Looks correct to me; this only narrows admission.
What I verified:
pinOnlyCommitsTrusted(automerge_human_paths.go:154-191) fails closed on every branch: head SHA unknown, list error, >3 pages, empty list, last entry ≠ head, missing SHA, untrusted author login, committer neitherweb-flownor trusted, unverified signature. There is no path that returns""without walking every commit.- Ordering is preserved: the classifier runs first (
:111), so the extraListCommitscall is only paid for a diff that already qualifies; the test table assertswantCommitHitsis 0 on refused diffs and 1 on accepted ones. - The committer rule is the piece that makes the author login non-spoofable (GitHub verifies against the committer email), and the fixtures cover exactly that case (
trusted author but foreign committer, verified: held). pr_approve_command.goand the sweep share the same helper, so/approvecannot disagree with the lane.- The package and its
_test.gofiles type-check on this head; finished CI test shards are green.
One open question for the maintainer, not a defect: this relies on no write-access principal being able to produce a commit whose resolved committer login is web-flow while the author is a trusted_authors bot. Web-UI edits and "Update branch" set the clicker as author, and Contents-API commits default the committer to the token's identity, so I believe that holds, but it is a GitHub-side property rather than something the diff can prove.
Body claims match the diff; Resolves #16380 / Refs #16399 scope matches what is actually changed (the upstream-ref anchoring item is untouched, as stated).
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Why
auto_merge.human_merge_pin_only(#16266) decides whether to waive the human-merge-path hold from the PR author login, GitHub's changed-file count and the syntax of the diff. The author login only records who opened the PR. Any principal withcontents: write— the populationhuman_merge_pathsexists to keep out of.github/workflows/**andContainerfile— can push a further commit onto that branch (adependabot/...branch keepsdependabot[bot]as PR author), and the sweep lanes and/approvethen admitted the new head without a person in the loop.This change makes the exception look at the commits behind the head, in the one helper both the sweep and
/approveshare so they keep agreeing:trusted_authors(same case-insensitive match as the PR author);web-flow(GitHub created and signed the commit, so GitHub set its author) or atrusted_authorslogin (a human trusted author committing locally);web-flow, verified) qualify as-is; a human trusted author must commit and sign as themselves.Any of those failing holds the PR exactly as before. The commit list is read only after the classifier accepts the diff, so a PR that is going to be held anyway still costs no extra API call. Docs and the operator reference now describe what the exception proves instead of listing commit provenance as a caller obligation.
Part of #16399: this closes its first item (commit provenance). The second item — anchoring a replaced
action-shato the upstream action's own refs rather than the fork network — is not in this PR, so #16399 stays open to track it.Tests
TestHumanMergePathGatePinOnlyExceptiongains fixtures for a foreign commit on the head, an unverified commit, a commit without an author login, a list that does not end at the head, an empty list and an unreadable list (all held), plus two verified trusted commits (admitted) and an assertion that the commit list is read only when the diff qualifies. Both tests also hold a verified commit whose author is trusted but whose committer is a foreign login, and the sweep test covers a missing committer login and a trusted author committing locally (admitted).TestPRApproveReplyPinOnlyMatchesSweepcovers the same refusals on the/approveside.Filed by sec-check agent (ACMM L6 — full mode)
— hive: agent=sec-check backend=copilot model=claude-fable-5.1 copilot=1.0.88
Resolves #16380. Supersedes #16394; #16399 remains open for its remaining upstream-reference work.