Repository navigation
π fix(github): verify base-refresh commits by signature and fail closed on compare cap - #16867
Conversation
β¦ on compare cap Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hive status β updated in place; edits do not notify. Full history is in the Activity Monitor. hive/awaiting-ci: CI pending β sweep will merge when green. π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 Evidence bundle `#168679e8188e` sha256:8970cc60cca545248b381222af8995c1d62c677d58598c47879743b8a0aecda4 β download from the dashboard or `hivectl review evidence #16867`. |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
There was a problem hiding this comment.
Read the tree, not just the diff β this looks correct to me, and the one way it could have broken the carry does not apply.
The check the fix depends on. CommitIsVerifiedAppMerge (src/pkg/github/pr_decision_base_refresh.go:260-266) now requires a GitHub-verified signature and committer web-flow or the App. That is only safe if the hive's own base refresh really is a GitHub-created merge. It is: the require_current_base path calls ghClient.UpdateBranchExpectedHead (src/cmd/hive/main_helpers.go:376), i.e. the PUT β¦/update-branch API, and there is no local git merge+push path producing refresh commits. GitHub signs those merges itself with committer web-flow, so legitimate refreshes keep carrying and an email-attributed push does not.
Fail-closed wiring. ErrCompareFileCap from compareAllFiles (:195-197) surfaces as err != nil in mergeIsBaseRefreshOf (:159-161 and :170-172), which returns false β the decision is superseded and the person is re-asked rather than carried. A compare with exactly 300 changed files is also treated as unverifiable; that is the conservative side of the cap and fine.
One note, no action needed. This is deliberately stricter than Client.CommitByHive (src/pkg/github/pr_merge_state.go:148-154), which still accepts an unverified commit whose committer login resolved to the App. That is appropriate here because only update-branch produces refresh commits, but it is worth knowing the two rules differ if anyone later reaches for CommitByHive on this path.
Tests cover the four rejection cases plus the 299/300-file boundary; fixtures in hold_guard_test.go, automerge_decision_carry_test.go and base_preparation_observation_test.go gain verification.verified=true, matching what GitHub actually returns for update-branch merges. Docs in hive-merge.md:362-372 now describe the new rule.
β hive: agent=reviewer-2 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 |
The base-refresh check decides whether a recorded human decision (and the base-preparation proof) may follow a PR onto a new head without anyone looking again. It trusted the merge commit because GitHub attributed it to the App bot β but GitHub derives that login from the author email, so anyone can write a merge that resolves to the App by using its noreply address. Attribution alone is not proof of who made the commit.
GitHub's update-branch merge is created and signed by GitHub itself (committer
web-flow, signature verified), so that is the evidence the check now requires; a signature binds only the committer, which is why a verified commit committed by someone else still does not count. This follows the same ruleCommitByHiveand the pin-only gate already apply (#15421).Separately, GitHub lists at most 300 files for a compare. Comparing two truncated lists can say "identical" when the files that differ were simply left out, so a compare at the cap is now treated as unverifiable and the decision stays where it was β the person is asked instead.
CommitByGitHubLoginkeeps its name and behaviour; the newCommitIsVerifiedAppMergeis what the checker uses. Tests cover an App-attributed but unverified/foreign-committed merge and a 300-file compare; existing fixtures gain the verification GitHub really returns.Closes #16860
β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88