Skip to content

🐛 fix(automerge): tighten pin-only exception trust check - #16394

Closed
hivecommons-hive[bot] wants to merge 1 commit into
v5from
scanner/fix-16380
Closed

hivecommons-hive[bot] wants to merge 1 commit into
v5from
scanner/fix-16380

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

The pin-only exception judged trust from the PR opener's login alone. It now also requires every commit on the PR to be authored and committed by a trusted author, and fails closed when the commit list is unavailable or incomplete. /approve shares the same helper, so its reply stays consistent with the sweep.

Closes #16380

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

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 3, 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/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 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
#16400 🐛 fix(automerge): require verified trusted-author commits for the pin-only exception CONFLICT src/pkg/github/automerge/automerge_human_paths.go
src/pkg/github/automerge/automerge_human_paths_test.go

@hivecommons-hive

hivecommons-hive Bot commented Nov 3, 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

Review findings from reviewer-2 (folded here because this head already carries its hive review):

The code is fail-closed and I found no way for an untrusted commit to pass it, so this is not a security regression. But the new check rejects two commit shapes that trusted hive PRs carry today, which would make the exception a no-op for the lane it was built for. A maintainer should decide whether that is intended before this merges.

1. Commits with no GitHub-resolved identity are refused (medium, correctness).
src/pkg/github/automerge/automerge_human_paths.go:124-126 — trusted() returns false when SafeGetLogin(u) is "", and safeGetLogin (src/pkg/github/client.go:3636-3638) returns "" for a nil user. GitHub populates author/committer on a commit only when the git email maps to an account. I checked the live commits on the cli-pin-bump PRs in this queue: GET /pulls/16391/commits and /pulls/16392/commits both return "author": null, "committer": null (git email hive-release@hive.kubestellar.io). With this change pinOnlyCommitsUntrusted returns "PR has a commit not authored and committed by a trusted author" at line 147 for every such PR, so a repo whose trusted_authors names the bump author would still be held on every bump.

2. web-flow committer is refused (medium, correctness).
Line 147 requires rc.Committer to be trusted too. Any commit made through the GitHub UI — accepted suggestion, "Update branch", web-edit — has committer web-flow. Live example: the third commit on hive#16366 (a hivecommons-hive[bot] PR) is author: hivecommons-hive[bot], committer: web-flow. Unless operators add web-flow to trusted_authors (which would be wrong — it is shared by every GitHub user), that PR class is permanently held.

Both are arguably acceptable if chosen; neither is mentioned in the PR body or #16380, which only asked that pushed commits be trusted. Options a human might pick: (a) accept as-is and document the restriction; (b) compare commit.author.email/commit.committer.email against the trusted bot's known noreply address when the user is nil; (c) require trusted author on each commit and verify the head SHA's committer only. I have not implemented any of them.

3. Docs still describe the old contract (low, docs-currency).
src/docs/hive-merge.md:180-182 ("the PR author is in trusted_authors (case-insensitive login match)") and src/docs/operator-reference/README.md:256 ("whose author is in trusted_authors") both state login-only trust; hive-merge.md:211-215 says attribution is tracked in #16269. Whatever is decided above, these need to say commits are checked too.

Verified otherwise: the helper is wired into both callers (automerge_human_paths.go:191, pr_approve_command.go:93), the pagination cap reuses stageDCOMaxPages (automerge_stage_dco.go:28), and the count cross-check (total == 0 || pr.GetCommits() != total) fails closed as described. Package builds at cd1b154.

@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 3, 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.

Conclusion: the direction is right (commit-level trust, fail closed), but the committer/author check as written will refuse the exception for the very PRs it exists to admit, because it keys on GitHub account resolution of each commit rather than on the pushed identity.

Finding (medium) — src/pkg/github/automerge/automerge_human_paths.go:122-146

pinOnlyCommitsUntrusted requires trusted(rc.Author) && trusted(rc.Committer) for every commit, where trusted(nil) → SafeGetLogin → "" → false. rc.Author / rc.Committer are GitHub's resolved accounts, which are null whenever the git author/committer email is not attached to a GitHub account. That is the normal state for the hive's own pin bumps: hive#16391 (cli-pin-bump/omp, one commit be417774) returns

author: null, committer: null, commit.author.name: hive-release[bot]

from GET /pulls/16391/commits. Under this PR that commit yields "PR has a commit not authored and committed by a trusted author" even though the PR opener is trusted and the diff is pin-only, so the exception can never admit a pin bump whose bot identity is a git-level name rather than a GitHub account.

A second, related gap: commits created through the GitHub API or signed by GitHub (Dependabot, Renovate with platformCommit, web-UI commits) resolve committer to web-flow, which no trusted_authors list will contain. For those bots author is trusted and committer is not, so they are held too.

Neither case is covered by the new test table (automerge_human_paths_test.go:404-409 synthesises author=committer=login for every commit), which is why CI is green.

Suggestion: anchor trust on the author (rc.Author trusted, or — for unmapped identities — rc.Commit.Author.Email/Name equal to a configured identity), and accept committer == web-flow only when rc.Commit.Verification.Verified is true. Keep the count check (pr.GetCommits() != total) — that part is sound. Add the two cases above to the table so the exception is proven to admit at least one real-shaped bot commit.

The ctx threading, pagination cap reuse (stageDCOMaxPages) and /approve sharing the helper all read correctly.

— hive reviewer · author model: claude-fable-5.1

— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot added stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 3, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Needs a decision, not a merge:

  • the reviewer swarm returned requires_human @cd1b154
  • the review found: the reviewer marked this change high-risk
  • reviewer question: @clubanderson should decide whether the pin-only exception must accept commits whose GitHub author/committer resolves to no user or to web-flow (real shapes on trusted hive PRs today), or whether rejecting them — and thereby holding every cli-pin-bump PR — is the intended trade-off.
  • the automerge lane will not merge this unattended

Head: verdict requires_human @cd1b154, 70/70 checks green, DCO yes, soak 0s of 10m0s.

What to do: approve this head (cd1b154) to merge as-is, or leave a changes requested review (or reply /hive decision <what to change>) and the hive will push the fix.

How to release it:

  • After reading the verdict, a trusted merger can submit a GitHub Approve review for the current head and the lane clears the hold on its next pass; /hive approve replies on a PR are acknowledged but not consumed.

Clear the cause and the hive re-evaluates on its next pass; the stage moves to stage/090-ready-for-human-merge, stage/095-pre-merge-soak or the merge queue on its own. Approval does not bypass CI, hold labels or other merge gates.

@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue and removed stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 3, 2026
@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 3, 2026
@clubanderson

Copy link
Copy Markdown
Member

Owner decision: superseded by #16400, which is the chosen verified-provenance implementation and now references #16380. Do not merge these competing edits together. Null/unmapped accounts and unsigned commits remain on the human path; web-flow is allowed only as a verified committer, not added as a trusted PR opener. #16399 stays open for its remaining upstream-reference work. Relay #16398 must share the chosen proof before landing.

@hivecommons-hive hivecommons-hive Bot added stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it and removed stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue labels Nov 3, 2026
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 conflicts-with-open-pr Open PR has a merge conflict with another open 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/M Denotes a PR that changes 30-99 lines, ignoring generated files. stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[reviewer] Review backlog (security): Pin-only exception trusts PR opener login, not the pushed commits

1 participant