Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
978e89e
fix: require verified signature for email-only hive commit identity m…
hivecommons-hive[bot] Oct 29, 2026
bd947ed
fix: count the author only by App-bot login in CommitByHive
hivecommons-hive[bot] Oct 29, 2026
d394f32
fix: sign the fixer's rebase of a contributor PR before the merge fol…
hivecommons-hive[bot] Oct 29, 2026
b67fd6b
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
9943700
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
f4c85d5
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
bef6f7e
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
2888114
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
088d244
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
def4608
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
e2799eb
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
4ff038c
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
1314c54
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
37a3dc0
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
260e39b
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
e40a835
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
f331846
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
89f4967
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
5aa7b45
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
e31d93d
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
8db32ba
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
96acc76
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
aa6c0c4
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
33cdbeb
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
5258aaf
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
79d824f
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
bdb7b08
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
b6f0a6d
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
9b6fd1c
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 29, 2026
8e25e30
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 30, 2026
09accfb
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 30, 2026
2737ff1
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 30, 2026
036b0ea
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 30, 2026
e2cb935
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 30, 2026
487f1ed
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 30, 2026
3513f96
merge v5 into scanner/fix-15182: keep both sides' follow-through tests
hivecommons-hive[bot] Oct 30, 2026
cba6d4b
drop fixer-rebase sealing; keep CommitByHive verified-signature tight…
hivecommons-hive[bot] Oct 30, 2026
4faf058
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 30, 2026
70b6ff0
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 30, 2026
e343fcc
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 30, 2026
cbd4544
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 30, 2026
2b9ee89
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 30, 2026
8e8ce7a
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 30, 2026
393a120
docs: state the fixer-rebase prerequisite for the verified email-only…
hivecommons-hive[bot] Oct 30, 2026
eb2f843
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 30, 2026
deb17bd
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 30, 2026
5553a1a
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 30, 2026
5b1b3f0
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 30, 2026
a68a98d
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 30, 2026
7088ec1
Merge branch 'v5' into scanner/fix-15182
hivecommons-hive[bot] Oct 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/changed-15182.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- The rebase-then-merge follow-through now counts a head as the hive's own by its committer: an email-domain-only match (no GitHub login resolved) needs GitHub to report the commit as verified, and the author counts only when GitHub resolves it to the App bot, since a signature never vouches for the author address ([#15182](https://github.com/hivecommons/hive/issues/15182)).
2 changes: 1 addition & 1 deletion src/docs/operator-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ verified owner or an authorized user with the `merger` role:
| Decision | What it does | Audit / ledger |
|---|---|---|
| `merge-now` β€” *Merge now as maintainer* (secondary; *Approve and let hive merge* leads) | Comments on the PR that @you merged it from the dashboard, then merges it at once through the hive's GitHub App (`MergePRVia`, audit path `dashboard`). Refused when the PR is merged or closed, or when you are its author. | `repo_item_decision_merge`; `last_operator_action.action: merge-now`; toast *merged*. |
| `merge-now` on a PR whose `mergeable_state` is `dirty` or `behind` β€” *Rebase, then merge as maintainer* | Never a GitHub 405. Records your approval first (/lgtm + /approve naming you), arms a rebase-then-merge follow-through (`/data/rebase-merge-followups.json`), kicks the rebase (update-branch on the hive's own PR when only behind; otherwise the fixer lane, which owns a parked PR with an armed follow-through), and answers `202 rebase-queued`. A 2-minute ticker then reads the PR: `mergeable_state: clean` on the rebased head β†’ merges it with your approval attributed; still `dirty` after 2 h, CI red, or no rebase within the deadline β†’ `failed` with the conflicting files and the options *Adopt into fresh branch* / *Close as superseded* (also left as a note on the PR). Refused on a fork whose author has not allowed maintainer edits (`head-not-pushable`). The approval is bound to the head you read: a new head on a contributor's PR counts as the rebase only when GitHub says the hive committed it (the fixer's rebase or update-branch under the App); a head anyone else pushes after your click settles the follow-through as `failed` (`foreign-head`) with nothing merged, a note on the PR, and *Approve the new head & merge* / *Close as superseded* as the ways out. | `repo_item_decision_merge` with `status: rebase-queued`; `last_operator_action.action: merge-now`, outcome `pending` β†’ `applied` / `failed`, `followed[]` steps `approval-recorded`, `rebase-kicked`, `rebased`, `ci-green`, `merged` / `failed`; row `rebase_merge.state`; toast *rebase queued, merge to follow*. |
| `merge-now` on a PR whose `mergeable_state` is `dirty` or `behind` β€” *Rebase, then merge as maintainer* | Never a GitHub 405. Records your approval first (/lgtm + /approve naming you), arms a rebase-then-merge follow-through (`/data/rebase-merge-followups.json`), kicks the rebase (update-branch on the hive's own PR when only behind; otherwise the fixer lane, which owns a parked PR with an armed follow-through), and answers `202 rebase-queued`. A 2-minute ticker then reads the PR: `mergeable_state: clean` on the rebased head β†’ merges it with your approval attributed; still `dirty` after 2 h, CI red, or no rebase within the deadline β†’ `failed` with the conflicting files and the options *Adopt into fresh branch* / *Close as superseded* (also left as a note on the PR). Refused on a fork whose author has not allowed maintainer edits (`head-not-pushable`). The approval is bound to the head you read: a new head on a contributor's PR counts as the rebase only when GitHub says the hive committed it β€” update-branch under the App (author resolved to the App bot) or a committer GitHub resolves to the App bot; a committer matched by the pane identity email domain alone, with no GitHub login resolved, also needs GitHub to report the commit as *verified*, and the author counts only when GitHub resolves it to the App bot ([#15182](https://github.com/hivecommons/hive/issues/15182)). **Operational prerequisite:** the fixer's own rebase of a contributor PR is a plain unsigned git commit (the push broker sets `commit.gpgsign=false`, and the signed-commit reconciler only re-signs PRs the App bot authored), so on a `dirty` contributor PR the follow-through settles `failed` (`foreign-head`) unless the fixer host signs its pushes with a key GitHub verifies against a pane-domain address; *Approve the new head & merge* on the fixer's head is the way out until then. A head anyone else pushes after your click settles the follow-through as `failed` (`foreign-head`) with nothing merged, a note on the PR, and *Approve the new head & merge* / *Close as superseded* as the ways out. | `repo_item_decision_merge` with `status: rebase-queued`; `last_operator_action.action: merge-now`, outcome `pending` β†’ `applied` / `failed`, `followed[]` steps `approval-recorded`, `rebase-kicked`, `rebased`, `ci-green`, `merged` / `failed`; row `rebase_merge.state`; toast *rebase queued, merge to follow*. |
| `queue-merge` β€” *Approve and let hive merge* (lead) | Admits the head (`admitted_by: operator-approval:<you>`), leaves an `APPROVED` review in your name with a note, adds the automerge label, and leaves the merge to the hive's auto-merge sweep, which merges through its own App on the next tick once CI is green and the head has soaked. On an untrusted author's PR that admission is the one thing that lets the trusted-author lane merge it: the lane's `untrusted-author-role` skip yields to the recorded approval for that exact head, and the merge comment names you (*merged by Hive on behalf of @you …*). Refused on your own PR. | `repo_item_decision_queue_merge`; `last_operator_action.action: queue-merge`; toast *approved β€” hive will merge on the next tick once CI is green*. |

**Approve is the trust override for that head
Expand Down
35 changes: 27 additions & 8 deletions src/pkg/github/pr_merge_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,21 @@ func (c *Client) GetPRMergeState(ctx context.Context, repo string, number int) (
}

// CommitByHive reports whether the commit at sha is the hive's own work:
// its author or committer resolves to the App bot (by login or noreply
// address) or to an address in the pane identity domain β€” the fixer's
// rebase or GitHub's update-branch under the App. A head a person pushed
// after a rebase-then-merge approval is new content the approval never
// covered, so the follow-through fails closed on it (hivecommons/hive#15104).
// its committer resolves to the App bot (by login or noreply address) or to
// an address in the pane identity domain, or its author resolves by login
// to the App bot, as on GitHub's update-branch under the App. When GitHub
// resolves no login for the committer, the email-only match also requires
// the commit's signature to be verified by GitHub, which binds the signing
// key to the committer address only (hivecommons/hive#15182); the author is
// free text GitHub never vouches for, so no email-only author match counts.
// The fixer's plain-git rebase of a contributor PR is an unsigned,
// email-only pane committer (the push broker sets commit.gpgsign=false and
// the signed reconcile pass only walks App-authored PRs), so it does not
// count unless the fixer host signs its pushes β€” the follow-through then
// settles foreign-head rather than trusting a spoofable address. A head a
// person pushed after a rebase-then-merge approval is new content the
// approval never covered, so the follow-through fails closed on it
// (hivecommons/hive#15104).
func (c *Client) CommitByHive(ctx context.Context, repo, sha string) (bool, error) {
if c == nil || c.client == nil {
return false, ErrNoGitHubClient
Expand All @@ -128,10 +138,19 @@ func (c *Client) CommitByHive(ctx context.Context, repo, sha string) (bool, erro
if err != nil {
return false, fmt.Errorf("reading %s/%s@%s: %w", owner, repoName, shortSHA(sha), err)
}
if c.hiveCommitIdentity(safeGetLogin(rc.GetCommitter()), rc.GetCommit().GetCommitter().GetEmail()) {
return true, nil
committerLogin := safeGetLogin(rc.GetCommitter())
if c.hiveCommitIdentity(committerLogin, rc.GetCommit().GetCommitter().GetEmail()) {
// An email-only match (no login resolved) counts only on a commit
// GitHub verified; a login resolved to the App bot counts as is.
if committerLogin != "" || rc.GetCommit().GetVerification().GetVerified() {
return true, nil
}
}
return c.hiveCommitIdentity(safeGetLogin(rc.GetAuthor()), rc.GetCommit().GetAuthor().GetEmail()), nil
// The author counts only by a login resolved to the App bot: a signature
// never covers the author address, so a verified commit proves nothing
// about an email-only author match.
authorLogin := safeGetLogin(rc.GetAuthor())
return authorLogin != "" && c.hiveCommitIdentity(authorLogin, rc.GetCommit().GetAuthor().GetEmail()), nil
}

// PRConflictCandidates names the files a PR changed that its base also
Expand Down
78 changes: 78 additions & 0 deletions src/pkg/github/pr_merge_state_commit_by_hive_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package github

import (
"context"
"encoding/json"
"net/http"
"net/http/httptest"
"testing"
)

// An email-only hive committer identity (no login resolved) counts as the
// hive's own only on a commit GitHub verified; a login resolved to the App
// bot counts whatever the verification. GitHub's verification binds the
// signing key to the committer address only, so an email-only author match
// never counts, verified or not (hivecommons/hive#15182).
func TestCommitByHive(t *testing.T) {
t.Setenv(signedTrailerDomainEnv, "")
type identity struct{ login, email string }
cases := []struct {
name string
author, committer identity
verification map[string]any
want bool
}{
{"email only, verified", identity{"", "quality@hive.kubestellar.io"}, identity{"", "quality@hive.kubestellar.io"}, map[string]any{"verified": true}, true},
{"email only, unverified", identity{"", "quality@hive.kubestellar.io"}, identity{"", "quality@hive.kubestellar.io"}, map[string]any{"verified": false}, false},
{"email only, no verification", identity{"", "quality@hive.kubestellar.io"}, identity{"", "quality@hive.kubestellar.io"}, nil, false},
{"bot noreply email only, unverified", identity{"", "1+hive-app[bot]@users.noreply.github.com"}, identity{"", "1+hive-app[bot]@users.noreply.github.com"}, map[string]any{"verified": false}, false},
{"bot login, unverified", identity{reconcileBot, "anything@example.com"}, identity{reconcileBot, "anything@example.com"}, map[string]any{"verified": false}, true},
{"bot login, no verification", identity{reconcileBot, "anything@example.com"}, identity{reconcileBot, "anything@example.com"}, nil, true},
{"person login, verified", identity{"alice", "quality@hive.kubestellar.io"}, identity{"alice", "quality@hive.kubestellar.io"}, map[string]any{"verified": true}, false},
// A signer forging --author into the pane domain: the signature vouches
// for alice as committer, never for the author address.
{"person committer, email-only pane author, verified", identity{"", "quality@hive.kubestellar.io"}, identity{"alice", "alice@example.com"}, map[string]any{"verified": true}, false},
{"person committer, email-only bot noreply author, verified", identity{"", "1+hive-app[bot]@users.noreply.github.com"}, identity{"alice", "alice@example.com"}, map[string]any{"verified": true}, false},
// update-branch under the App: author resolves to the bot, GitHub commits.
{"bot login author, web-flow committer", identity{reconcileBot, "1+hive-app[bot]@users.noreply.github.com"}, identity{"web-flow", "noreply@github.com"}, map[string]any{"verified": true}, true},
{"bot login author, web-flow committer, unverified", identity{reconcileBot, "1+hive-app[bot]@users.noreply.github.com"}, identity{"web-flow", "noreply@github.com"}, nil, true},
// The fixer's rebase keeps the person as author; the hive commits.
{"person author, email-only pane committer, verified", identity{"alice", "alice@example.com"}, identity{"", "fixer@hive.kubestellar.io"}, map[string]any{"verified": true}, true},
{"person author, email-only pane committer, unverified", identity{"alice", "alice@example.com"}, identity{"", "fixer@hive.kubestellar.io"}, map[string]any{"verified": false}, false},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/repos/acme/widget/commits/abc123" {
t.Fatalf("unexpected request: %s %s", r.Method, r.URL.String())
}
commit := map[string]any{
"author": map[string]any{"name": "n", "email": tc.author.email},
"committer": map[string]any{"name": "n", "email": tc.committer.email},
"message": "m",
}
if tc.verification != nil {
commit["verification"] = tc.verification
}
body := map[string]any{"sha": "abc123", "commit": commit}
if tc.author.login != "" {
body["author"] = map[string]any{"login": tc.author.login}
}
if tc.committer.login != "" {
body["committer"] = map[string]any{"login": tc.committer.login}
}
json.NewEncoder(w).Encode(body)
}))
defer server.Close()
c := NewClientForTest(server.URL, "acme", []string{"widget"}, nil)
c.SetAppBotLogin(reconcileBot)
got, err := c.CommitByHive(context.Background(), "acme/widget", "abc123")
if err != nil {
t.Fatalf("CommitByHive: %v", err)
}
if got != tc.want {
t.Errorf("CommitByHive = %v, want %v", got, tc.want)
}
})
}
}
Loading