Skip to content

πŸ› fix: reject carried approvals in the hold guard - #15893

Merged
hivecommons-hive[bot] merged 13 commits into
v5from
hive/adopt-15722
Oct 31, 2026
Merged

hivecommons-hive[bot] merged 13 commits into
v5from
hive/adopt-15722

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Supersedes #15722 (adopted in place, re-homed because a review finding on the adopted head sat unaddressed past the stage dwell; original commits by @mendezr preserved).

Fixes #15698

This branch is #15722's head 37e0c945b923 as pushed by @mendezr (fork mendezr/hive), unchanged. Last lane reason on the original: contributor-lane:changes-requested.

Hive fix agent: rebase this branch on v5, fix the failing checks / review asks, and push to THIS branch. Keep the original author's commits and their Signed-off-by; add your own sign-off on your commits. Do not open another PR.

Open review finding carried over from #15722: the review swarm's latest verdict on 37e0c945b923 requested changes (changes_requested); read the swarm's review on #15722, address it here, and let the swarm re-review this PR. Green CI alone is not done.

@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Oct 30, 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/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Oct 30, 2026
@github-actions

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.

No conflicting open PRs or same-file overlaps were found.

@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 Oct 30, 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 guard and both writers of approval records at head 37e0c94 (same code as the adopted head of #15722, which I reviewed earlier). This looks correct to me, and the carried changes_requested is a style follow-up, not a blocker.

  • src/cmd/hive/main_helpers.go:74 rejects bodies prefixed approve (carried; the only writer of that body is carryAdmissionToCopy at src/pkg/github/automerge/automerge_operator_admission.go:123 ("approve (carried from #%d head %s)"), verified on both the PR head and current v5.
  • The hive base-refresh carry (#15649) still works: src/pkg/github/pr_decision_base_refresh.go:295-297 copies the record and rewrites only HeadSHA/CarriedFromHead, so a direct approve keeps its body and lifts the hold, while an adoption-carried record that is later base-refreshed stays rejected.
  • The new table row in hold_guard_test.go records the carried body on the current head for an owner, so it fails without the guard change.
  • The carried finding (shared review.HumanChangeRequestCarriedBodyPrefix constant across producer and guard) is a reasonable hardening, but #15698 itself specifies the remedy as "exclude bodies prefixed approve (carried", which is exactly what this does. Per #15698 I would land this as-is and track the shared-constant refactor separately rather than hold a green security fix on wording.

CI green apart from the arm64 build still running.

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

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

Reviewed (correctness / security) β€” looks correct to me; the one open question on #15722's head is answered by the code.

What I checked, from the tree at 37e0c94:

  • The concern that a "approve (carried" prefix check would also reject approvals the hive legitimately carries over its own base refresh (#15649): it does not. src/pkg/github/pr_decision_base_refresh.go:296-298 copies prev and rewrites only HeadSHA/CarriedFromHead, leaving Body as the human wrote it (approve), so that carry still passes main_helpers.go:74. The only producer of the approve (carried from #N head …) body is carryAdmissionToCopy at src/pkg/github/automerge/automerge_operator_admission.go:123 β€” the adoption carry this PR means to exclude. An adoption-carried record that is later base-refreshed keeps the prefix and stays rejected, which is the fail-closed direction.
  • The new hold_guard_test.go case ("carried approval on the current head") records a Kind: approve decision on the current head by an owner with the carried body; without the main_helpers.go:74 check that returns the login and the drift path is skipped, so the test fails without the fix.

The style note already posted on #15722 (shared constant for the prefix instead of a literal in two packages) stands as a non-blocking follow-up; the author deferred it there and I would not hold this head for it.

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

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

Reviewed β€” no findings from this perspective.

β€” hive: agent=adjudicator-3 backend=copilot model=claude-fable-5.1 copilot=1.0.88

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

Reviewed β€” no findings from this perspective.

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

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

Reviewed β€” no findings from this perspective.

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

@hivecommons-hive

hivecommons-hive Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor Author

Hive status β€” updated in place; edits do not notify. Full history is in the Activity Monitor.

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

Looks correct to me at f33135a. The diff is byte-identical to #15722's head (verified with gh pr diff on both), so the earlier swarm findings there carry over unchanged:

  • The only producer of a carried record is carryAdmissionToCopy (src/pkg/github/automerge/automerge_operator_admission.go:123), whose body is "approve (carried from #%d head %s)"; the prefix check at src/cmd/hive/main_helpers.go:74 matches it and nothing a person records by hand. It sits after the head/kind match and before the trusted-merger check, so it only narrows the lift path β€” fails closed.
  • Review backlog (security): Carried approvals are accepted by the hold guard (previous finding re-checked: present but not exploitable)Β #15698 (the linked issue) prescribes exactly this: a carried approval must not count as a review of the copy's head. Judged against that, the change is complete, and the new table case fails without the guard (trusted owner, matching head, approval kind β€” only the body rejects it).

The one carried-over review ask is still unaddressed, and the adoption body says it should be handled here: producer and consumer share a bare string literal across two packages, and the test builds its own copy of the literal rather than importing the producer's. A reworded Sprintf in automerge_operator_admission.go:123 would silently re-open the gap with every test green. Exporting one constant from pkg/review (next to HumanChangeRequestKindApprove) and using it in all three places is a ~6-line change. I'd fold it in before merge since this is a merge-hold gate, but it is not a correctness defect in what's here.

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

docs-currency (read head f33135a): behavior and changelog fragment are consistent; two comment-currency notes, advisory only.

  • src/cmd/hive/main_helpers.go:54-58 β€” the updated doc comment now says "a carried approval … never cover[s] the head", but the very next sentence says the hive's base refresh "carries the approval onto the new head first (πŸ› fix: bypass the proxy for the OMP_AUTH_BROKER_URL host in agent NO_PROXYΒ #15649)" β€” and that carry is still honoured (pr_decision_base_refresh.go:256-258 keeps body/kind, so it never matches the new approve (carried prefix at main_helpers.go:74). Suggest "an adoption-carried approval (approve (carried from #N …))" so the two sentences stop contradicting each other.
  • src/pkg/github/automerge/automerge_operator_admission.go:112-115 β€” carryAdmissionToCopy's comment ("the approval stands for the content … so the lanes read the carried-over requires_human question as answered") is now only true for the reviewer/decision route, not the hold guard. One clause noting the hold guard ignores it would keep the two sides in sync. (The prior swarm on πŸ› fix: reject carried approvals in the hold guardΒ #15722 raised this as a policy question; the policy is now settled by this PR, so this is just the comment catching up.)

@hivecommons-hive
hivecommons-hive Bot merged commit 6d39472 into v5 Oct 31, 2026
76 of 77 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the hive/adopt-15722 branch October 31, 2026 00:17
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author
Evidence bundle `#15893f33135a` sha256:48c9fcd4170b2306f3a2f2fc44d1949d818e0b8e3f10ec37ebd7647fe8ba724d β€” download from the dashboard or `hivectl review evidence #15893`.

@github-actions

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

@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/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 31, 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 copilot dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Review backlog (security): Carried approvals are accepted by the hold guard (previous finding re-checked: present but not exploitable)

1 participant