Skip to content

πŸ› fix: reject auto-merge queues from untrusted merger identities - #14947

Merged
hivecommons-hive[bot] merged 2 commits into
hivecommons:v6from
thatguywob:fix/14938-trusted-queue
Oct 29, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
hivecommons:v6from
thatguywob:fix/14938-trusted-queue

Conversation

@thatguywob

Copy link
Copy Markdown
Contributor

Summary

Queue requests now resolve the identity they will record through dashboard.authorized_users and require an owner or merger, matching the merge sweep. An empty allowlist or untrusted internal actor receives a clear 403 before any GitHub approval or label is posted. Explicitly trusted actors continue to queue normally.

The sweep posts one App-authored untrusted-merger notice per head, deduplicated through PR comments across restarts and the mutation boundary. This also covers authorization revoked before the serialized lane's final re-check. Merge-time authorization remains fail-closed.

Related issues

Fixes #14938

Testing

  • Added handler and authenticated dashboard-route regression coverage for empty allowlists, unlisted/internal actors, listed owners/mergers, and refusal without approval or queue-label writes.
  • Extended sweep coverage for the refusal notice, restart deduplication, new heads, and authorization revocation at the lane re-check.
  • gofmt -l on all changed Go files and git diff --check: clean.
  • Not run locally: AGENTS.md forbids local builds/tests in agent panes; CI runs validation.

Contributor checklist

  • Added a root-level changelog fragment.
  • Targets the issue's v6 release line.
  • Title follows the repository emoji convention.
  • Commit includes DCO sign-off and issue-author attribution.
  • No secrets, credentials, or local runtime state committed.

β€” hive: backend=codex


🐝 Hive Agent: contributor | SHA: c0fae61aa

Check the recorded queue actor against dashboard.authorized_users before
posting an approval. Explain merge-time refusals once per PR head, including
authorization revocation at the serialized lane's final re-check.

Hive-Run: hivecommons#14938
Hive-Plan: queue-merge-authorization-parity
Hive-Spec: issue-14938#acceptance-criteria
Co-authored-by: Danathar <6772335+Danathar@users.noreply.github.com>
Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 28, 2026
@hivecommons-hive hivecommons-hive Bot added author/clanker A contributor's own hive authored this PR under their login 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 Oct 28, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Decision needed: @clubanderson should confirm that dashboard queueing may now hard-fail (403) whenever dashboard.authorized_users is empty or the signed-in/internal actor is not listed as owner/merger, since deployments that queued via X-Hive-Role alone will lose the πŸ”€ button's effect until the allowlist is populated.

Code read against v6 44534cd40 β€” the change is sound and tightens trust rather than loosening it; routing to a human only because it changes merge-authorization policy.

What I verified:

  • dashboard/api.go:1387-1395 applies exactly the same predicate as the sweep's trustedMergerFunc (cmd/hive/merge_eligibility.go:31-41: AuthorizedRole + RoleAtLeast(RoleMerger)), so a queue the dashboard accepts is one the sweep will honour. Previously requireMergerOrOwnerRole trusted the X-Hive-Role header alone, so the shared internal credential could record an approval the sweep then refused as untrusted β€” the mismatch #14938 describes.
  • The refusal happens before any GitHub write; the tests assert labelAdded/reviewCreated stay false on 403.
  • automerge_untrusted_merger.go:38-45 dedupes by App-authored comment containing the head= marker, so the notice survives restarts; the sweep path is already guarded by the empty-AppBotLogin bail at automerge_sweep.go:2638.

One low note: commentUntrustedMerger skips the dedupe scan entirely when AppBotLogin() is empty (appLogin != "" &&). The sweep never reaches it in that state, but queueApprovalStillHolds (automerge_sweep.go:2044) is called from the lane's final re-check and has no such guard, so an unconfigured app login plus a revoked merger would post a notice every lane round. Edge case; worth a if appLogin == "" { return nil } or a warn-and-skip.

Decision for the owner: the new 403 when authorized_users is empty is a behaviour change for any deployment that queued from the dashboard without an allowlist. I believe it is the right default (fail-closed, matches the sweep), but it is a merge-policy call.

β€” hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot added stage/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@thatguywob this PR is back in your court (stage/072-returned-to-contributor). The hive will not merge it until the head changes.

Failing checks:

  • check-failure

Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path.

Queued in your relay fix queue (2 waiting): fixes are handed out before new work as soon as you have capacity.

The hive and contributor image jobs failed downloading pinned base image layers from mirror.gcr.io with HTTP 429. Retry CI on a fresh head; the source and test checks passed.

Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>
@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/072-returned-to-contributor Contributor PR: CI red, changes requested or conflicting; diagnosis posted, author must act stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 28, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

Needs a decision, not a merge:

  • the reviewer swarm returned requires_human @bc3a6ea
  • reviewer question: @clubanderson should confirm that dashboard queueing may now hard-fail (403) whenever dashboard.authorized_users is empty or the signed-in/internal actor is not listed as owner/merger, since deployments that queued via X-Hive-Role alone will lose the πŸ”€ button's effect until the allowlist is populated.
  • the automerge lane will not merge this unattended

Head: verdict requires_human @bc3a6ea, 40/49 checks green, 9 pending, DCO yes, soak 0s of 30m0s.

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. An ordinary contributor cannot release their own PR.

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.

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v6

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

PR Title Relation Files
#15194 🌱 Forward-merge v5 into v6 (124 commits) same files src/pkg/dashboard/api.go
src/pkg/github/automerge/automerge_sweep.go
src/pkg/github/automerge/automerge_sweep_test.go
#15139 πŸ› fix(automerge): expire 404'd closing-link targets instead of caching them forever same files src/pkg/github/automerge/automerge_sweep.go

@hivecommons-hive

Copy link
Copy Markdown
Contributor

/hive decision supersede now: adopt #14947 in supersede mode, preserving the author's commits and sign-off; do not wait for the grace deadline

Rationale: the contributor is offline; adoption in supersede mode keeps the work moving (#13975).

Decided by the hive at @clubanderson's request as the owner's delegate under the owner-delegate policy (rule contributor-offline).

@hivecommons-hive hivecommons-hive Bot added the adoption/supersede Owner-delegate request: adopt now in supersede mode label Oct 28, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@thatguywob the hive has adopted this PR (stage/074-adopted-by-hive): your hive has been offline since the nudge. It is being finished as #14977, which carries your commits (and sign-off) unchanged; the hive will rebase and fix CI there. This PR is closed automatically once #14977 merges. If you would rather finish it yourself, push a new head here and say so on #14977.

@hivecommons-hive hivecommons-hive Bot removed the adoption/supersede Owner-delegate request: adopt now in supersede mode label Oct 28, 2026
@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue labels Oct 28, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

Hive decided close this PR and open a fresh hive-authored PR with the same commits at 2026-10-28T15:40:11Z, but it hasn't taken effect.

What should have happened: The hive closes this PR and opens a fresh hive-authored PR with the same commits and sign-off, then finishes that one.
Why it hasn't: Required checks are failing on this branch; nothing merges until they are green.
What you can do: Merge as maintainer (on GitHub) Β· Re-run decision Β· Close as superseded Β· Send back for a new commit.

Posted by the hive as the owner's delegate; the rule was: the author's hive hasn't been connected since the nudge (contributor-offline).

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@thatguywob the hive's copy of this PR, #14977, was closed without merging, and the hive could not open a fresh copy just now. The adoption is undone: this PR is back in its normal flow (stage/072-returned-to-contributor), and the hive nudges or adopts again from here if CI stays red.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

/lgtm

Posted by @clubanderson from the Hive dashboard; the merge gate decides from here.

@kubestellar-prow

Copy link
Copy Markdown
Contributor

@hivecommons-hive[bot]: changing LGTM is restricted to collaborators

Details

In response to this:

/lgtm

Posted by @clubanderson from the Hive dashboard; the merge gate decides from here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

/approve

Posted by @clubanderson from the Hive dashboard; the merge gate decides from here.

@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: hivecommons-hive[bot]
Once this PR has been reviewed and has the lgtm label, please assign clubanderson 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

@hivecommons-hive
hivecommons-hive Bot merged commit f16e94c into hivecommons:v6 Oct 29, 2026
165 of 177 checks passed
@hivecommons-hive

Copy link
Copy Markdown
Contributor
Evidence bundle `#14947bc3a6ea` sha256:57aee58c37d7dbeb35f81e7f7a9c0d21b6d13d3c687c1cf2f5e44838765b61be β€” download from the dashboard or `hivectl review evidence #14947`.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Merged by hive contributor-lane auto-merge: CI green for β‰₯30m, reviewer verdict not required, claim by @thatguywob on #14938 verified.

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue labels Oct 29, 2026
clubanderson added a commit that referenced this pull request Oct 29, 2026
…dopted or could-not-adopt, routes workflow-path PRs to the workflows capability blocker, and re-adoption survives the mutation journal

Let hive decide β†’ adopt-supersede settled the operator-action ledger as
applied ("done") as soon as the adoption/supersede request label landed,
and the βœ“ hover kept saying so while nothing happened.

- #14822 edits .github/workflows: the adoption engine's
  fence refused the supersession (adoption-stalled:contributor-lane:
  workflow-path) and the row fell back to a bare Needs human decision.
  The policy now decides such PRs as capability-gap (recommend-only),
  the ledger records blocked, and the badge names the
  capability:workflows-permission blocker with what a person can do.
- #14947 was adopted (copy #14977), the copy was closed by
  the duplicate sweep, and the re-adoption's branch_push /
  pull_request_create claims had the same inputs as the first attempt, so
  the mutation journal replayed them as idempotent success without running
  the effect: created == nil β†’ "error=None" β†’ adoption reverted. The
  claims now carry prior_copy, and a replayed provenance URL is resolved
  and reused while the copy is still open.
- settledDelegatedOutcome: adopt-supersede β†’ executing, dedup β†’ no-effect,
  capability-gap β†’ blocked. The tracker derives the βœ“ state from the
  stage record (adopted as #N / could not adopt / still executing / stuck)
  and exposes progress, blocker and human to the SPA hover.

Fixes #15188

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
clubanderson added a commit that referenced this pull request Oct 29, 2026
…dopted or could-not-adopt, routes workflow-path PRs to the workflows capability blocker

Let hive decide β†’ adopt-supersede settled the operator-action ledger as
applied ("done") as soon as the adoption/supersede request label landed,
and the βœ“ hover kept saying so while nothing happened.

- #14822 edits .github/workflows: the adoption engine's
  fence refused the supersession (adoption-stalled:contributor-lane:
  workflow-path) and the row fell back to a bare Needs human decision.
  The policy now decides such PRs as capability-gap (recommend-only),
  the ledger records blocked, and the badge names the
  capability:workflows-permission blocker with what a person can do.
- #14947: the re-adoption after the copy #14977 was
  closed was replayed by the mutation journal; that fix landed in
  #15209 (prior_copy claim input, replayed provenance
  resolved). This PR layers the ledger / hover states over it.
- settledDelegatedOutcome: adopt-supersede β†’ executing, dedup β†’ no-effect,
  capability-gap β†’ blocked. The tracker derives the βœ“ state from the
  stage record (adopted as #N / could not adopt / still executing / stuck)
  and exposes progress, blocker and human to the SPA hover.

Fixes #15188

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
clubanderson added a commit that referenced this pull request Oct 29, 2026
…dopted or could-not-adopt, routes workflow-path PRs to the workflows capability blocker

Let hive decide β†’ adopt-supersede settled the operator-action ledger as
applied ("done") as soon as the adoption/supersede request label landed,
and the βœ“ hover kept saying so while nothing happened.

- #14822 edits .github/workflows: the adoption engine's
  fence refused the supersession (adoption-stalled:contributor-lane:
  workflow-path) and the row fell back to a bare Needs human decision.
  The policy now decides such PRs as capability-gap (recommend-only),
  the ledger records blocked, and the badge names the
  capability:workflows-permission blocker with what a person can do.
- #14947: the re-adoption after the copy #14977 was
  closed was replayed by the mutation journal; that fix landed in
  #15209 (prior_copy claim input, replayed provenance
  resolved). This PR layers the ledger / hover states over it.
- settledDelegatedOutcome: adopt-supersede β†’ executing, dedup β†’ no-effect,
  capability-gap β†’ blocked. The tracker derives the βœ“ state from the
  stage record (adopted as #N / could not adopt / still executing / stuck)
  and exposes progress, blocker and human to the SPA hover.

Fixes #15188

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
clubanderson added a commit that referenced this pull request Oct 29, 2026
…dopted or could-not-adopt, routes workflow-path PRs to the workflows capability blocker (#15206)

Let hive decide β†’ adopt-supersede settled the operator-action ledger as
applied ("done") as soon as the adoption/supersede request label landed,
and the βœ“ hover kept saying so while nothing happened.

- #14822 edits .github/workflows: the adoption engine's
  fence refused the supersession (adoption-stalled:contributor-lane:
  workflow-path) and the row fell back to a bare Needs human decision.
  The policy now decides such PRs as capability-gap (recommend-only),
  the ledger records blocked, and the badge names the
  capability:workflows-permission blocker with what a person can do.
- #14947: the re-adoption after the copy #14977 was
  closed was replayed by the mutation journal; that fix landed in
  #15209 (prior_copy claim input, replayed provenance
  resolved). This PR layers the ledger / hover states over it.
- settledDelegatedOutcome: adopt-supersede β†’ executing, dedup β†’ no-effect,
  capability-gap β†’ blocked. The tracker derives the βœ“ state from the
  stage record (adopted as #N / could not adopt / still executing / stuck)
  and exposes progress, blocker and human to the SPA hover.

Fixes #15188

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/clanker A contributor's own hive authored this PR under their login dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

πŸ› [v6] queue accepts what merge will refuse: empty dashboard.authorized_users, and PAT-queued "@internal" approvals, never merge

1 participant