Skip to content

🐛 fix(github): delegated issue decisions sanitise reporter-authored option text - #16949

Merged
hivecommons-hive[bot] merged 3 commits into
v6from
scanner/fix-16937
Nov 6, 2026
Merged

hivecommons-hive[bot] merged 3 commits into
v6from
scanner/fix-16937

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Closes #16937

Why: a non-hive reporter controls the option text in an issue body, and the delegate records the chosen option as /hive decision go with option N: <summary> attributed to the owner. The existing cleaning (comments, mentions, length) is a best-effort filter; a label-only decision for reporter-authored options is a stronger boundary that also covers any future path that executes a recommended option without an owner preview.

Additive and backward compatible: delegatedecision.Option gains an optional Untrusted field (omitted from JSON when false); labels, summaries (still shown in the plan), ids and config are unchanged. Options from hive-authored issues or hive comments render exactly as before. Test pins the marking and label-only naming.

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

…red option text verbatim

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@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 nicholasjackson 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 6, 2026
@github-actions

github-actions Bot commented Nov 6, 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.

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

@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: synced branch with v6 (2 commits behind) for a fresh build-hub run after the registry-blob fetch failure; 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 adjudicator-2 (folded here because this head already carries its hive review):

Security review (head dc0f713) — no blocker. The label-only boundary is correctly placed: body options are marked Untrusted only when !isHiveAccount(issueAuthor) and m.optionSource == "" (issue_decision_options.go:23,27), and unparkMenuFor sets optionSource only from a hive comment (issue_unpark_menu.go:103,157), so hive-comment options stay trusted whoever filed the issue; the numbered path tracks fromBody the same way (issue_decision_options.go:34-37,57-61). competingOptionsDecision builds the recorded text via chosen.Name() (competing_options.go:62), which now omits the summary (competing_options.go:39) before RecordOperatorIssueDecision (api_repo_item_decide_delegated.go:1099).

One advisory gap between body and diff:

  • Plan sentence loses the summary too. The body says summaries are "still shown in the plan", but delegatedPlanWording also goes through d.Option.Name() (api_repo_item_decide_delegated_plan.go:343), so for reporter-authored options the owner's preview reads "Go with option 2 — the option #N recommends…" with no option text. option.summary survives only in the JSON (policy.go:392), which stageTrackerDelegatePlanHtml does not render (tracker-actions.js:1690-1700: sentence/why/next only). Not a security regression, but the owner now previews less than the body claims; if the preview is meant to keep the summary, pass it to the plan sentence separately rather than via Name().

Not verified here: go test is disabled on this host; packages build (go build ./pkg/delegatedecision/ ./pkg/github/) and the new test was read, not run.

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

Style review (head dc0f713) — one in-scope finding.

Lettered-options branch of the fix is keyed off an unrelated field and has no test. src/pkg/github/issue_decision_options.go:26 marks options untrusted with bodyUntrusted && m.optionSource == "", using the comment html_url (issue_unpark_menu.go:39-41, :157) as a proxy for "came from the body". The numbered-list branch, by contrast, tracks provenance with an explicit fromBody flag (:34-56). The new test TestIssueDecisionOptionsMarkReporterBodyUntrusted (issue_decision_options_test.go:137-167) only uses dakotaStyleOptions/utah920Body/utah920Park, all numbered lists (:14-30), so the lettered path is unpinned — and because ghComment (issue_unpark_menu_test.go:17-19) never sets HTMLURL, a lettered hive-comment fixture would currently be marked untrusted by that proxy.

Suggested fix: add an optionsFromBody bool to unparkMenu set alongside optionSource (mirroring fromBody in the numbered branch) and add lettered-options cases to the new test (reporter body → untrusted; hive comment → trusted).

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

Read the diff against v6 at merge-base 8fd5f734, plus issue_unpark_menu.go, competing_options.go, facts.go and the dashboard plan builder. The trust boundary itself is right: Untrusted is set only when the options came from the body (optionSource == "" for the lettered path, fromBody for the numbered path) and the issue author is not a hive account; hive comments keep their summaries on either path. go build of pkg/github, pkg/delegatedecision, pkg/dashboard is clean on dc0f713.

One gap between the body and the code, worth fixing before this lands:

The owner preview loses the summary too — src/pkg/dashboard/api_repo_item_decide_delegated_plan.go:343 builds the plan headline from d.Option.Name(), and competing_options.go:39 now drops the summary from Name() whenever Untrusted is set. So for exactly the case this PR hardens, the dashboard plan reads "Go with option 2 — the option #N recommends — and let the hive build it." with no text saying what option 2 is. The body says summaries are "still shown in the plan"; they are still in the Option struct, but nothing in the plan renders Summary directly (grep: Name() is the only consumer besides JSON). Issue #16937 listed "the owner sees the exact option named in the plan before executing" as the existing mitigation — this change weakens that preview while hardening the recorded command. Severity: medium (owner approves a label they cannot read in context). Suggested fix: keep Name() label-only for the recorded /hive decision, but have the plan builder append strings.TrimSpace(d.Option.Summary) itself (the plan is HTML-escaped by the dashboard per tracker-actions.js:1686-1688, and it is a preview, not an owner-attributed record) — or, if dropping it from the preview is intended, say so in the body and the changelog fragment.

Minor, not blocking:

  • IssueDecisionOptions infers "from body" on the lettered path from m.optionSource == "" (issue_decision_options.go:26). Production comments come from Issues.ListComments so html_url is always populated, but the test helper ghComment (issue_unpark_menu_test.go:17) builds comments with no HTMLURL, so a lettered-options hive comment on a reporter-filed issue would be marked untrusted in tests. The new test only exercises the numbered-comment path (utah920Park), so this is not caught. A fromBody bool on unparkMenu would make the signal explicit and let that case be pinned.
Evidence bundle `#169497dcc010` sha256:b06e4c46d2d5e2b1409b50d13ac9055bc253c7ed8c807241360d5ca7bd8f0d5a — download from the dashboard or `hivectl review evidence #16949`.

@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 stage/050-review-pending Review swarm requested; awaiting a verdict for the current head role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) 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.

docs-currency review of dc0f713 (read the diff plus the files it touches and their callers).

  1. PR body says the summary is "still shown in the plan"; the diff drops it there too. competing_options.go:62 builds the decision text from chosen.Name(), and the owner-facing plan at src/pkg/dashboard/api_repo_item_decide_delegated_plan.go:343 is also "Go with " + d.Option.Name() + …. With Untrusted set, Name() (competing_options.go:37-43) returns the bare label, so for a reporter-filed issue the plan reads Go with option 2 — the option #N recommends… and the "What hive saw" facts list labels only (src/pkg/delegatedecision/facts.go:180-185). The owner preview that #16937 cites as the mitigation no longer shows what option 2 is. Suggested fix: in api_repo_item_decide_delegated_plan.go:343 render d.Option.Label plus d.Option.Summary explicitly (the dashboard already escapes plan text), keeping Name() label-only for the recorded /hive decision; then the PR body claim holds.

  2. Operator doc still shows the quoted form unconditionally. src/docs/dashboard-sections/activity-monitor.md:720 says the plan reads Go with option 2: … and the recorded /hive decision go with option 2: … "names the option". After this change, options read from the body of a non-hive-filed issue are recorded as go with option 2 with no summary. Add a clause there (and the changelog fragment already says it) so the doc matches the behaviour the fragment describes.

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

@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/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 6, 2026
…views the reporter's summary

Review follow-ups on #16949:

- unparkMenu gains an explicit optionsFromBody flag instead of inferring
  provenance from optionSource == "": a hive comment read without its
  html_url is still hive-authored text. The test now covers lettered
  options from a hive comment on a reporter's issue, and a hive comment
  replacing the reporter's body options.
- The "Let hive decide" plan sentence shows a reporter-authored option's
  summary as a quoted, one-line excerpt of the issue's words, so the owner
  sees what they approve while Name() — and the recorded decision — stay
  label-only. Changelog fragment says so.

Hive-Fix-Attempt: 1/6
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: ci-maintainer <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 6, 2026
@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it 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 diff against the v6 tree and the consumers of delegatedecision.Option. Looks correct to me.

  • The recorded decision text is built from Option.Name() at src/pkg/delegatedecision/competing_options.go:62 ("go with "+chosen.Name()), so with Untrusted set the owner-attributed /hive decision carries only option N — which is exactly the boundary #16937 asked for.
  • Untrusted is only set when the options came from the issue body and the issue author is not a hive account (issue_decision_options.go:23,26,57). Hive comments override and clear optionsFromBody (issue_unpark_menu.go:163), and the withdrawn-park branch resets it (:137), so hive-authored text keeps its summary as before.
  • The preview (api_repo_item_decide_delegated_plan.go:306-320) is the only place the reporter prose is still shown, and it is labelled as the issue's words rather than hive's description; Summary was already passed through that path before this PR, so no new exposure.

Note for the merger: build-hub (linux/amd64) is red and the sign-off job was cancelled on this head; I did not triage that run — nothing in this diff touches the hub image, so it looks environmental rather than a defect in the change.

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

CI triage (head 4a54935): both build-hub jobs (linux/amd64 and linux/arm64) failed in ~35s at the buildx stage with failed to compute cache key: … httpReadSeeker: could not fetch content descriptor sha256:b677f0d6… not found. That's a missing remote registry/cache layer, not a code failure in this PR — no source changes are needed. Re-running the build-hub jobs once the registry blob is available should go 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

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it 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 at 7dcc010 against the v6 tree (not only the diff). This looks correct to me.

What I verified

  • The only non-test producer of the recorded decision text is competingOptionsDecision (src/pkg/delegatedecision/competing_options.go:62, "go with "+chosen.Name()), and Option.Name() now drops the summary when Untrusted is set (competing_options.go:39). So the delegate's /hive decision go with option N is label-only for reporter-authored body options, exactly as #16937 asks.
  • Provenance is tracked by optionsFromBody, not by optionSource == "": set in unparkMenuFromBody (issue_unpark_menu.go:68), cleared when a hive comment supplies options (:163) and on park withdrawal (:137). I checked every assignment to m.options in unparkMenuFor; there are no other reset sites, so the flag cannot go stale.
  • The numbered-options fallback in IssueDecisionOptions (issue_decision_options.go:34-60) tracks fromBody through the same withdraw/replace transitions and only marks Untrusted when the surviving source is the body of a non-hive author.
  • The preview (delegatedPlanOptionName, api_repo_item_decide_delegated_plan.go:311-321) still shows the owner the quoted summary, so the owner knows what they are approving; empty summary adds no quote. Test pins both.
  • go build of pkg/delegatedecision, pkg/github, pkg/dashboard passes at this head.

One note, info only (not a defect, out of #16937's scope)

The owner-typed /hive approve on an issue still records the reporter's summary verbatim: unparkMenu.approveDecision() (issue_unpark_menu.go:289-296) builds go with option N + summaryFor(...) from m.optionText, called at issue_unpark_command.go:607. That text is the owner's own explicit command rather than a delegate-attributed one, and it goes through unparkCleanOptionSummary as before, so the trust posture matches what #16937 called "mitigated". If the intent is for the label-only boundary to be uniform, approveDecision could consult optionsFromBody the same way; a maintainer can decide whether that belongs here or in a follow-up. Not blocking.

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

@hivecommons-hive
hivecommons-hive Bot merged commit c2ff975 into v6 Nov 6, 2026
83 of 86 checks passed
@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

@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 Nov 6, 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/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.

[reviewer] Review backlog (security): Issue-author-controlled option text is quoted into an owner-attributed /hive decision (mitigated)

0 participants