Skip to content

πŸ› fix(github): verify base-refresh commits by signature and fail closed on compare cap - #16867

Merged
hivecommons-hive[bot] merged 1 commit into
v5from
scanner/fix-16860
Nov 6, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
v5from
scanner/fix-16860

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

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 rule CommitByHive and 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.

CommitByGitHubLogin keeps its name and behaviour; the new CommitIsVerifiedAppMerge is 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

… on compare cap

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 6, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign danathar for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 6, 2026
@hivecommons-hive

hivecommons-hive Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor Author

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: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

β€” 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`.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#16607 ✨ feat(github): enforce pin-only exception in merge-request relay same files src/docs/hive-merge.md
#16858 πŸ› fix: workflow-path fence approval survives the hive's own base refresh same files src/docs/hive-merge.md

@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 6, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

@hivecommons-hive
hivecommons-hive Bot merged commit bb8b382 into v5 Nov 6, 2026
86 of 91 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-16860 branch November 6, 2026 02:48
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

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

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR copilot dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) size/L Denotes a PR that changes 100-499 lines, ignoring generated files. stage/050-review-pending Review swarm requested; awaiting a verdict for the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[reviewer] Review backlog (security): BaseRefreshChecker trusts email-derived GitHub login and a 300-file compare cap

0 participants