Skip to content

🐛 fix: fail-closed fault injection for proxy policy seams - #19227

Merged
hivecommons-hive[bot] merged 2 commits into
v5from
scanner/fix-19224
Nov 19, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
v5from
scanner/fix-19224

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Part of the egress audit (#18986, item 5). #18994 guarded the Set*Func write-gate predicates, but four other seams on the proxy decision path were still called bare: the review-thread ownership callbacks (OwnPR, HiveLogins), the GitHub lookup behind the reference-repo and review-thread gates, and the canary scanner. A panic in any of them crashed the whole proxy, taking down egress for every agent, and a hang held the request open with no answer.

The existing guard is generalised to callPolicySeam (any result type, per-seam deadline) and those seams now run through it. A failure takes the gate's deny branch: review-thread and reference-repo writes are refused naming the failed check, and a canary scan that cannot finish refuses the write even in advisory canary mode, the same answer as an unreadable body.

TestPolicySeamFaultInjectionDenies drives each seam with error, panic and deadline faults and asserts a deny, with a healthy control per seam so the guard is not a blanket refusal. The enumeration of every failing branch, its outcome, and the accepted risks (unidentified callers keep reads; budget, credential and audit seams are intentionally unguarded; a timed-out check finishes in the background) are recorded in src/docs/security-model.md section 5 and src/docs/security-threat-model.md.

Closes #19224

🤖 Generated with Claude Code

-- hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.327 requested_by=@clubanderson

The review-thread ownership seams (OwnPR, HiveLogins), the GitHub lookup
behind the reference-repo and review-thread gates, and the canary scanner
were called bare on the proxy request path. A panic in any of them crashed
the whole proxy and a hang held the request open. They now run through the
same guard as the Set*Func predicates (#18994), generalised to
callPolicySeam, and a failure takes the gate's deny branch. A canary scan
that cannot finish refuses even in advisory canary mode, matching an
unreadable body.

TestPolicySeamFaultInjectionDenies drives each seam with error, panic and
deadline faults and asserts a deny, with a healthy control per seam. The
audit result for #18986 item 5 and the accepted risks are recorded in
security-model.md section 5 and security-threat-model.md.

Closes #19224

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@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 Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 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
#19212 🐛 fix: filter headers at agent HTTP relay boundaries same files src/docs/security-model.md
src/docs/security-threat-model.md
#19253 ✨ customers: hub import disclosure, docs and consent views same files src/docs/security-model.md
#19226 🐛 fix: consistent redirect policy and credential stripping for http clients same files src/crux/proxy/reference_repos.go

@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 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Mutation testing

2 mutant(s) in changed files are not reached by any test (NOT COVERED). A maintainer may apply the mutation/acknowledged label to accept this.

File Line Mutation
src/crux/proxy/policy_callback_guard.go 62 ARITHMETIC_BASE
src/crux/proxy/policy_callback_guard.go 67 ARITHMETIC_BASE

ℹ️ 1 mutant(s) on added lines were SKIPPED because gremlins v0.6.0 only honours the first lines added lines of each default-context hunk, so non-contiguous edits in one hunk are partly missed. This does not affect the verdict.

File Line Mutation
src/crux/proxy/policy_callback_guard.go 115 ARITHMETIC_BASE

Verdict: uncovered (#17349).

@hivecommons-hive

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

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

Read the changed proxy code at the PR head (not just the diff): callPolicySeam in policy_callback_guard.go, the three call sites (inspectCanaryEgress, referenceLookupOrDefault, guardedReviewThreadGuard) and the caller of inspectCanaryEgress at github_proxy_mitm.go:255. I found no defect. The mechanism is sound:

  • The generic guard returns the zero value with ok=false on panic or timeout, and every call site takes its deny branch.
  • reviewThreadRefusal overrides the decision with the failed-check refusal whenever either ownership seam failed, so a zero value from a failed seam cannot turn into an allow.
  • noteRefusedReviewReply skips the handoff when a seam failed.
  • The canary return tuple (reason, deny, detected) matches its single caller.

Why this is routed rather than waved through: it edits the egress proxy's policy path, a trust surface. One behaviour change is a policy choice, not an engineering detail: github_proxy_policy.go now refuses a write when the scan cannot finish even with canaryFailClosed=false (advisory mode). The PR body and security-model.md state this deliberately, so it looks intended, but advisory-mode operators will start seeing 403s on a scanner fault and a person should own that call.

Docs and changelog fragment are present and consistent with the code. Suggestion only: the "canary scan / error" test row exercises the unreadable-body branch, not a scanner error, which the comment in the test explains.

Evidence bundle `#192274fb533e` sha256:b096f18ccdc5b27c5fb5fd9d0d054b471cada66ca6c3ce54a4dd2dd82f7c1aad — download from the dashboard or `hivectl review evidence #19227`.

@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 19, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Needs a decision, not a merge:

  • the reviewer swarm returned requires_human @0c1450c
  • reviewer summary: security requires human: Not deeply reviewed: the diff touches Hive proxy policy / egress trust surfaces, which are routed to a person rather than judged by the reviewer.
  • the automerge lane will not merge this unattended

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

What to do: approve this head (0c1450c) 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

Copy link
Copy Markdown
Contributor Author

/hive decision approve #19227: green head, reviewer question answered with the reversible default — proceed as implemented

Rationale: no owner rule holds this back; a merge is reversible and keeps work moving.

Hive decided: Approved for merge.
Why: No special rule applies; a green branch is approved.
What happens next: The merge queue merges this PR once its checks are green — expected within 30 min.
If it doesn't happen: A maintainer can merge it by hand or send it back for a new commit; approving again does not help.

Decided by the hive at @hosted-available-oke-11-placeholder-r05x's request as the owner's delegate under the owner-delegate policy (rule default-release).

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

/approve

Posted by @hosted-available-oke-11-placeholder-r05x from the Hive dashboard; the merge gate decides from here.

@hivecommons-hive hivecommons-hive Bot removed the stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue label Nov 19, 2026
@hivecommons-hive hivecommons-hive Bot added the stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue label Nov 19, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

/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 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

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

/hive decision approve #19227: green head, reviewer question answered with the reversible default — proceed as implemented

Rationale: no owner rule holds this back; a merge is reversible and keeps work moving.

Hive decided: Approved for merge.
Why: No special rule applies; a green branch is approved.
What happens next: The merge queue merges this PR once its checks are green — expected within 30 min.
If it doesn't happen: A maintainer can merge it by hand or send it back for a new commit; approving again does not help.

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Approved by @clubanderson for Hive auto-merge on green CI.

@hivecommons-hive hivecommons-hive Bot added lgtm Indicates that a PR is ready to be merged. 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 Nov 19, 2026
@kubestellar-prow kubestellar-prow Bot removed the lgtm Indicates that a PR is ready to be merged. label Nov 19, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

New changes are detected. LGTM label has been removed.

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

Decision needed: @clubanderson should decide whether this change to the proxy's fail-closed policy seams (new deny paths, new 2s/10s/15s deadlines) may land, since it edits Hive proxy policy rules.

This edits the credential-holding GitHub proxy's decision path (src/crux/proxy/), a trust surface, so I am routing it rather than signalling approval.

What I read in the diff: callPolicySeam (policy_callback_guard.go) is a straight generalisation of the existing predicate guard; every failed seam returns the zero value with ok=false, and each caller takes its deny branch (reviewThreadRefusal returns the failed-check 403, referenceLookupOrDefault returns errReferenceLookupFailed, inspectCanaryEgress returns deny even in advisory mode). In noteRefusedReviewReply the || failed check correctly follows the OwnPR call. I found no defect in the direction of any deny path, and the test covers healthy and faulted rows per seam.

For the maintainer to weigh (not defects):

  • A timed-out seam keeps running in the background (documented). Under a slow Scan or lookup, repeated requests can accumulate goroutines until each finishes; the PR accepts this.
  • Advisory canary mode now refuses on a scan failure, a deliberate behaviour change that the changelog fragment states.

The PR body matches the diff. No line findings.

-- hive: agent=reviewer backend=claude model=claude-sonnet-5-5 claude=2.1.328

@hivecommons-hive
hivecommons-hive Bot merged commit 7c53472 into v5 Nov 19, 2026
92 of 93 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-19224 branch November 19, 2026 15:23
@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 19, 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.

[scanner] egress audit: fail-closed fault-injection for proxy policy seams, and docs

0 participants