Skip to content

πŸ› fix: [v6] hub-signed relay lets hosted spokes verify relayed GitHub webhooks - #17915

Merged
clubanderson merged 7 commits into
v6from
scanner/fix-17910
Nov 12, 2026
Merged

clubanderson merged 7 commits into
v6from
scanner/fix-17910

Conversation

@hivecommons-hive

@hivecommons-hive hivecommons-hive Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Closes #17910

Forward-port of the v5 fix (PR #17914) for #17911, cherry-picked onto v6 @ c984347. Conflicts were resolved so v6's additions are kept: Rejected1h, LastRejectedAt, annotateModeLocked, and per-reason RecordWebhookDeliveryFailure(reason).

Problem

The hub verifies each GitHub App delivery and relays it with GitHub's original X-Hub-Signature-256. The spoke has to re-verify that signature with the App webhook secret, but no hosted spoke has that secret. So hosted spokes answered every relay with 503 and ran on polling only, and event-driven review dispatch (ReviewEventDrivenEnabled(githubWebhooksConfigured())) stayed off.

Design: option 2 (per-hive hub relay key), not option 1 (ship the App secret)

  • Option 1 would copy one fleet-wide secret to every hosted spoke. The App webhook secret authenticates GitHub deliveries for the whole App. With it, any compromised spoke could sign forged deliveries and POST them to any other spoke's public /api/webhook/github. It would also turn one hub secret into one copy per spoke, so a single leak would mean rotating the secret on the GitHub App and on every spoke.
  • Option 2 limits the damage to one hive. Each hosted hive has its own random 256-bit relay key. A key held by one spoke cannot sign a relay that another spoke accepts. No spoke ever receives the App webhook secret.
  • The key travels on a per-hive authenticated channel. It is delivered only over the hive's own heartbeat, which verifyHeartbeatBearer authenticates with the per-hive bearer before anything is attached. A spoke can't claim another hive_id and pull that hive's key.

What changed

Hub

  • SaaSHive.WebhookRelayKey holds the key, generated with crypto/rand.

    • It is set when a hive is created: pool placeholder, handleCreateHive, hosted lite.
    • A hosted hive provisioned before this fix gets a key minted on its first heartbeat, so the existing fleet is covered.
    • The owner-facing handleHiveStatus response removes the key. Only the spoke's heartbeat carries it.
  • Delivery uses HeartbeatGitHubAppConfig.WebhookRelayKey, an additive field.

    • It is attached independently of the App-identity branches, the same way as SecondaryKey, and only while the spoke's reported webhook_relay_key_fingerprint (sha256, non-secret) doesn't match the record.
    • Rotation: replace or clear the key on the record. The fingerprint then stops matching and the next beat delivers the new key.
  • relayWebhookToSpoke forwards GitHub's headers unchanged. For a hive with a relay key it also adds:

    • X-Hive-Relay-Timestamp: <unix seconds>
    • X-Hive-Relay-Signature-256: sha256=<hex HMAC-SHA256(key, timestamp + "." + X-GitHub-Delivery + "." + raw body)>

    Hives the hub did not provision (no record, so no key) get the relay exactly as before.

Spoke

  • github.AdoptWebhookRelayKey stores the key in /data/webhook-relay.key (0600, atomic write), so a restarted spoke can verify relays before its first heartbeat.
    • An empty value is a no-op. It never clears a working key.
    • The key is adopted before the App-identity write guard, so a refused identity push can't drop it.
  • The heartbeat reports WebhookRelayKeyFingerprint, never the key itself.
  • api_github_webhook.go accepts a delivery when either check passes:
    1. The GitHub signature verifies with GITHUB_WEBHOOK_SECRET. This path is unchanged and has no new replay check.
    2. The hub relay signature verifies with the relay key, using a constant-time hmac.Equal. This follows the existing verifyGitHubWebhookSignature.
  • Replay protection (relay path only). These checks run after the MAC verifies:
    • A timestamp more than 5 minutes off in either direction is rejected as relay_timestamp_stale.
    • A missing delivery ID is rejected as relay_delivery_missing.
    • A delivery ID accepted within the last 10 minutes is rejected as relay_delivery_replayed. The IDs live in a per-server in-memory set capped at 4096 entries. 10 minutes is twice the skew window, so it covers every timestamp that would still verify.
    • A bad MAC is rejected as relay_signature_invalid.
    • Each rejection returns 401 with its reason, is logged, and is counted through RecordWebhookDeliveryFailure(), the same as a bad GitHub signature today.
  • With no secret and no relay key, the spoke still answers 503.
  • githubWebhooksConfigured() is now true when a relay key is present, so event-driven review dispatch turns on for hosted hives.
  • /api/status.webhooks has a new verification field: github-signed, relay (hub-signed) or none.

Tests

  • Hub:
    • The relay signature verifies with the target hive's key and not with another hive's.
    • The signature binds the delivery ID and a fresh timestamp.
    • GitHub's signature and body are forwarded unchanged.
    • A hive without a key gets the relay unsigned.
    • Heartbeat: the key is delivered until the spoke confirms it, minted for a legacy hive, not re-sent once the fingerprint matches, and re-delivered after rotation.
    • Hive status never exposes the key.
    • Hub ↔ spoke wire round trip.
  • Spoke:
    • A relay-signed delivery is accepted and applied with no secret.
    • Rejected: tampered body, another hive's key, delivery ID swapped after signing, unsigned relay, stale or future timestamp, missing delivery ID, replayed delivery ID.
    • A rejected relay degrades the cadence like a bad signature.
    • The GitHub-signed path is unchanged, including repeated delivery IDs.
    • The relay key turns githubWebhooksConfigured() and verification on.
    • The replay set stays bounded and expires entries.
  • Spoke store: adopt, redeliver, rotate, reload from disk; an empty value never clears the key; file mode is 0600; the fingerprint format matches the hub's.

v6-specific additions

  • The relay rejections are now reason codes in pkg/github: relay_signature_invalid, relay_timestamp_stale, relay_delivery_replayed and relay_delivery_missing.
    • They are recorded with RecordWebhookDeliveryFailure(reason), so they show up in /api/status.webhooks.mode_reason_code and rejected_1h next to the existing codes.
  • no_secret is reported only when there is no secret and also no relay key. A hosted spoke holding a relay key no longer gets a no_secret deep-health warning.
  • The deep-health webhooks check (and so MCP health_deep_read, which wraps /api/health/deep) now includes verification.
    • Its detail says "via relay (hub-signed)".
    • A relay reason code gets its own warning.
  • docs/webhooks.md lists the new reason codes and the verification field.
  • New test: with a relay key, deep health passes with verification: relay (hub-signed) and no no_secret. A forged relay then sets mode_reason_code to relay_signature_invalid, sets rejected_1h to 1, and produces a deep-health warning.

Differences from the issue spec

  • Rotation: there is no admin endpoint. Rotation means replacing or clearing the key on the hive record, and the heartbeat re-delivers it. For about one heartbeat interval after a rotation, relays signed with the new key are rejected.
  • Manual redelivery: a GitHub "Redeliver" of the same delivery ID within 10 minutes is rejected as a replay on the relay path.
  • Beyond the spec (security): handleHiveStatus removes the relay key from the owner-facing record.
  • Storage: the key is kept in the hive's hub record (meta.json). The hub needs the raw key to sign.
  • On-disk permissions (per @clubanderson's review, cherry-picked from v5 πŸ› fix: hub-signed relay lets hosted spokes verify relayed GitHub webhooksΒ #17914): because meta.json now carries a credential, saveSaaSHive creates hive record directories 0o700 (was 0o755), strips group/other bits from a pre-existing directory on every save without ever widening a read-only one, and writes meta.json 0o600 (was 0o644) β€” the same mode the other hub stores use. Anything outside the hub process that read hive records as another uid (backup sidecars, ad-hoc tooling) loses access after the first save; run such readers as the hub uid.

Decision taken by hive: when a spoke has both GITHUB_WEBHOOK_SECRET and a relay key, the GitHub signature is checked first, the relay signature is the fallback, and verification reports github-signed.

Validation: only gofmt -l was run locally, per repo policy. CI is the verdict.

β€” hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 requested_by=@Danathar

…ooks

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Co-authored-by: Danathar <6772335+Danathar@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 12, 2026
@kubestellar-prow kubestellar-prow Bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Nov 12, 2026
@hivecommons-hive

hivecommons-hive Bot commented Nov 12, 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: pushed api-reference citation resync (the links/changelog-guard failures were citation drift from the server.go route shift). CI pending β€” sweep will merge when green.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: b4fa5f15b

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

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

Read the diff against v6 @ c984347 plus the callers (handleGitHubWebhook, handleHeartbeat, relayWebhookToSpoke, saveSaaSHive). The design holds up: the relay MAC binds timestamp + delivery ID + body, verification is constant-time (src/pkg/dashboard/webhook_relay.go:43-58), the replay TTL (2Γ— skew) covers every timestamp that would still verify, and the key only ever leaves the hub on the per-hive authenticated heartbeat (src/pkg/hub/server.go:3376). handleHiveStatus strips it and I found no other endpoint that encodes a raw SaaSHive. The v6-specific resolution (RecordWebhookDeliveryFailure(reason), Rejected1h, per-reason health text) is consistent across webhook_cache.go / webhook_mode.go / health_webhooks.go.

Two things need a push before this can land:

1. Both red checks are the same citation drift (blocking). The comment edit at src/pkg/dashboard/server.go:2706 adds three lines above the route registrations, so every src/docs/api-reference.md citation into that file now points one block off. changelog-fragment-guard fails in its "api-reference citations must be resynced" step (the fragment itself is fine and in the right place β€” root changelog.d/), and relative links and anchors resolve reports DRIFT api-reference.md:36-43 … server.go:1833-1851. Per AGENTS.md, run bash src/scripts/check-api-reference-citations.sh --fix and commit; do not hand-edit the line numbers.

2. The new hub-side secret lands in a world-readable file (medium). SaaSHive.WebhookRelayKey (src/pkg/hub/saas_provision.go:800) is serialised into meta.json by saveSaaSHive, which writes 0o644 under a 0o755 directory (src/pkg/hub/saas_provision.go:2087,2094). Until this PR the hive record deliberately carried no key material (saas_provision.go:709 says so for the App identity). Every other secret store in pkg/hub is 0o600 β€” cluster_app_key.go:31, hub_generations_store.go:34, hub_session_revocation.go:229 β€” and the spoke half of this very PR gets it right (src/pkg/github/webhook_relay_key.go:102). A relay key is enough to forge a GitHub delivery to that hive's public /api/webhook/github, which is exactly the blast radius the PR body argues option 2 is meant to contain. Suggested fix: either tighten saveSaaSHive to 0o600 (and the dir to 0o700) or keep the key in its own 0o600 sibling file keyed by hive ID. The v5 PR #17914 has the identical gap, so whichever fix lands should be mirrored there.

Not a defect, just noting: webhookRelayKeyForHeartbeat does a fresh load-modify-save (src/pkg/hub/webhook_relay_key.go:111) while handleHeartbeat holds an earlier copy of the record from line 2991; nothing after line 3376 saves that copy, so the minted key is not clobbered within one beat. A concurrent writer elsewhere could still drop it, but the fingerprint mismatch re-mints on the next beat, so it self-heals.

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

Security perspective (head a8a6ac0) β€” no in-scope blocker. Verified: the heartbeat lane that delivers WebhookRelayKey runs after the per-hive bearer is bound to payload.HiveID (src/pkg/hub/server.go:1928, :3373-3385), so a spoke can only pull its own key; handleHiveStatus strips it (src/pkg/hub/saas_hives_api.go:1637-1640) and no other hub endpoint encodes a raw SaaSHive; the hub signs only GitHub-verified bodies (src/pkg/hub/webhook.go:88-92 β†’ :190-194); the spoke MACs before trusting timestamp/delivery and records replay IDs only after the MAC passes (src/pkg/dashboard/webhook_relay.go:103-120); the on-disk key is 0600 and excluded from backups.

One low advisory, non-blocking:

  • Relay MAC input is dot-joined without length framing β€” src/pkg/hub/webhook_relay_key.go:63-70 and src/pkg/dashboard/webhook_relay.go:51-58 MAC ts + "." + delivery + "." + body. The delivery/body boundary is ambiguous: a captured relay re-presented with the delivery's trailing bytes moved into the body (or vice versa) yields the same MAC bytes under a different delivery ID, which would dodge the replay cache keyed on X-GitHub-Delivery. Not exploitable today because the shifted body is no longer valid JSON and GitHub delivery IDs are UUIDs, but a length-prefixed or \x00-separated encoding (or MACing sha256(delivery)) would make the construction unambiguous. Fine to land as a follow-up.

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

Correctness review (head a8a6ac0) β€” relay signing/verification, replay cache, key delivery and persistence check out against #17910; the hub and spoke MACs agree byte-for-byte (src/pkg/hub/webhook_relay_key.go:64-71 vs src/pkg/dashboard/webhook_relay.go:51-57), the fingerprint-gated heartbeat delivery rides the same independent path as SecondaryKey (src/pkg/hub/server.go:3376-3386), and the spoke callback fires for any non-nil GitHubAppConfig so a relay-key-only beat is adopted before the identity guard (src/cmd/hive/main.go:5676-5680). No in-scope blocker.

One advisory (low):

  • Unsigned relay to a hosted spoke is misreported as signature_failed. src/pkg/dashboard/api_github_webhook.go:86-92: when secret == "" and the relay key is present but X-Hive-Relay-Signature-256 is absent (hub still on a pre-fix build during a mixed-version rollout, or GitHub posting directly), the handler records WebhookReasonSignatureFailed. Deep health then renders that as "GITHUB_WEBHOOK_SECRET does not match the secret the sender signs with" (src/pkg/dashboard/health_webhooks.go:50-51) on a spoke that has no GITHUB_WEBHOOK_SECRET at all. Suggest recording WebhookReasonRelaySignatureFailed on that branch when secret == "", so the relay-specific health text points at the hub rather than at a nonexistent secret. Behaviour (reject + count) is otherwise correct.

@github-actions

github-actions Bot commented Nov 12, 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
#17917 πŸ› fix: report agent delivery failures in deep health same files src/docs/api-reference.md
src/pkg/dashboard/server.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 12, 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 (head b1685f3). The three touched docs are accurate against the code, but three operator-facing docs this change invalidates were not updated.

  1. src/docs/review-swarm.md:733 β€” still says review.event_driven unset "means on exactly when GITHUB_WEBHOOK_SECRET is set". After this PR the gate is githubWebhooksConfigured() β†’ github.WebhookVerification() != WebhookVerificationNone (src/pkg/dashboard/api_review_event_dispatch.go:29-31), so it is also on with a hub relay key and no secret. Turning event-driven dispatch on for hosted hives is the headline outcome of #17910, and this sentence now tells a hosted operator the opposite. Fix: "…on exactly when the spoke can verify webhooks (GITHUB_WEBHOOK_SECRET, or a hub relay key on a hosted hive β€” /api/status.webhooks.verification != none)".

  2. src/docs/api-reference.md:37 and src/docs/api-reference/health-status-events.md:28 β€” the /api/health/deep webhooks field list (status, detail, mode, mode_reason_code, rejected_1h) omits the new verification key added at src/pkg/dashboard/server.go:4012, and the cause list ("no GITHUB_WEBHOOK_SECRET, signature mismatch, undecodable payload") omits the four relay rejections now surfaced as warnings (src/pkg/dashboard/health_webhooks.go:36-41).

  3. src/docs/webhooks.md:242 β€” "signature_failed means the secret does not match the sender's". On a hosted spoke with no secret, a relay that arrives without X-Hive-Relay-Signature-256 is also recorded as signature_failed (src/pkg/dashboard/api_github_webhook.go:86-91), i.e. an unsigned/unprovisioned relay, not a secret mismatch. One clause covering that case would keep the reason-code table truthful.

Advisory (not blocking): /data/webhook-relay.key is not in the spoke backup manifest (src/docs/backup-restore.md:182-190); that is fine since the hub re-delivers on the next heartbeat when the fingerprint is missing, but worth a one-line note there so a restore operator does not go looking for it.

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

@hivecommons-hive

hivecommons-hive Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Review follow-ups (below review.backlog.min_severity: P2)

Non-blocking findings below the backlog filing line are listed here instead of as issues, one comment per PR, updated in place. Tick them off as they are fixed; set review.backlog.min_severity: P3 to file every finding.

  • P3 info correctness β€” Mint-on-heartbeat uses unlocked load-modify-save of meta.json (src/pkg/hub/webhook_relay_key.go:104): webhookRelayKeyForHeartbeat calls loadSaaSHive then saveSaaSHive (saas_provision.go:2065/2081, no per-hive lock). Any concurrent writer holding a stale copy of the record can drop the minted key; the…
  • P3 info docs-currency β€” Spoke backup manifest doc does not mention /data/webhook-relay.key (src/docs/backup-restore.md:187): The new persisted key file /data/webhook-relay.key (src/pkg/github/webhook_relay_key.go:22) is not in the spoke backup file table. Not a defect: the hub re-delivers the key on the next heartbeat when…
  • P3 info intent-alignment β€” Advisory: relay fallback changes the recorded reason when a spoke holds both secret and relay key (src/pkg/dashboard/api_github_webhook.go:86): When GITHUB_WEBHOOK_SECRET is set, the GitHub signature fails, and the request carries X-Hive-Relay-Signature-256 with a relay key held, the handler falls through to verifyWebhookRelay and records a …
  • P3 info style β€” Relay wire format implemented in three packages (src/pkg/dashboard/webhook_relay.go:30): Header names, HMAC layout (timestamp.delivery.body) and the sha256: fingerprint format are duplicated in pkg/hub/webhook_relay_key.go, pkg/dashboard/webhook_relay.go and pkg/github/webhook_relay_key.…
  • P3 low security β€” Relay-key heartbeat lane inherits the pre-existing unauthenticated path when hubSecret is empty (src/pkg/hub/server.go:1927): handleHeartbeat only calls verifyHeartbeatBearer inside if s.hubSecret != "" (server.go:1927-1932). With no hub secret configured, webhookRelayKeyForHeartbeat (server.go:3376) will hand any caller …

@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 12, 2026
…ason aliases

Review follow-ups for #17915:
- review-swarm.md: event_driven default keys off webhook verification (secret or hub relay key), not only GITHUB_WEBHOOK_SECRET
- api-reference: /api/health/deep webhooks object now lists verification and the relay_* warn causes
- webhooks.md: signature_failed also covers an unsigned relay on a hosted spoke without a secret
- backup-restore.md: note /data/webhook-relay.key is intentionally not archived (hub re-delivers it)
- pkg/dashboard: use github.WebhookReasonRelay* directly instead of package-local aliases

Hive-Fix-Attempt: 1/6
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 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 12, 2026
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>

@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: @Danathar should decide whether a hub-minted per-hive relay credential, stored in plaintext on the hive record (meta.json) and delivered to spokes over the heartbeat, is acceptable as the trust mechanism for the public /api/webhook/github endpoint on hosted spokes.

Conclusion: I read the signing/verification code, the heartbeat delivery path and the callers on both sides and found no correctness defect. This introduces a new credential and a new authentication path on a public endpoint, so a maintainer should sign off on the trust model rather than me. The only red CI is mechanical docs-citation drift.

What I verified (v6 @ 4ad3e30)

  • Signing and verification agree byte-for-byte: pkg/hub/webhook_relay_key.go:60-68 and pkg/dashboard/webhook_relay.go:43-58 both MAC timestamp "." delivery "." body; hmac.Equal on the spoke.
  • The MAC is checked before the timestamp is parsed or the delivery ID is remembered (webhook_relay.go:104-119), so unsigned traffic cannot fill the replay cache. Cache is bounded at 4096 and pruned on insert (webhook_relay.go:71-96).
  • X-GitHub-Delivery is in the hub's forwarded header set (pkg/hub/webhook.go:181), so the spoke's delivery binding sees the same value the hub signed.
  • Key delivery runs after verifyHeartbeatBearer (pkg/hub/server.go:1928 β†’ :3376), so a spoke is only ever handed its own hive's key. Note the bearer check is gated on s.hubSecret != "" β€” pre-existing, and the same gate the App private-key lanes already rely on, so not a regression.
  • handleHiveStatus copies the record and blanks WebhookRelayKey before encoding (saas_hives_api.go:1637-1640). The list endpoints at saas_hives_api.go:587/828/2241 project into entry structs rather than encoding SaaSHive, so I found no other owner-facing path that leaks it.
  • Self-hosted path unchanged: with GITHUB_WEBHOOK_SECRET set and no relay key, a bad GitHub signature still fails at api_github_webhook.go:86-92 exactly as before.
  • Body claims I checked against the diff all hold (fingerprint-gated delivery, 0600 atomic write, empty-key no-op, legacy-fleet minting on first beat).

Why CI is red

changelog-fragment-guard / Docs Link Check / native-queue-policy are all the same failure: the citation guard reports DRIFT for ~24 src/docs/api-reference*.md lines pointing at pkg/dashboard/server.go and api_review_event_dispatch.go. Cause: the new webhookRelaySeen field at server.go:110 and the import change in api_review_event_dispatch.go:3-9 shifted line numbers. Per AGENTS.md, run python3 src/scripts/check-docs-citations.py --fix and push β€” no hand edits. The fragment changelog.d/fixed-hosted-webhook-relay-signature.md itself is present and well-formed.

Open question for the decision above (not a defect): the relay key lives in plaintext in the hive record alongside the other per-hive material, and the hub needs the raw key to sign. The PR body states this and chooses it deliberately. I am flagging it only because a new long-lived credential on a public endpoint is a trust-policy call, not an engineering one.

I have not approved or changed anything.

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

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

Copy link
Copy Markdown
Contributor Author

Needs a decision, not a merge:

  • the reviewer swarm returned requires_human @b4fa5f1
  • reviewer summary: correctness requires human: Delta re-review (4ad3e30 -> b4fa5f1) from the correctness perspective. The delta is 68 lines across 6 docs files (src/docs/api-reference.md and src/docs/api-reference/*.md) and consists solely of renumbering server.go:NNNN citations by +1 (1833->1834 ... 1928->1929) and api_review_event_dispatch.go:16 -> :15; stripping line numbers, the before/after text is byte-identical. No Go code, tests, or behavior changed. Verified each new citation resolves to the named route registration at head (e.g. server.go:1834 GET /api/health, :1835 GET /api/health/deep, :1929 GET /branding/custom.css; api_review_event_dispatch.go:15 registerReviewEventDispatchRoutes). Prior findings: [docs-currency] server.go:110 citation drift β€” FIXED (citations resolve; changelog-fragment-guard passes at head). [security] webhook_relay_key.go:104 long-lived relay credential needs approver sign-off β€” STILL PRESENT (not touched by the delta; owned by the security perspective, keeps the whole-PR verdict at requires_human). No new in-scope or out-of-scope correctness findings; code outside the delta stands as judged at the previous head. Hub/dashboard/agent test matrix was still pending at review time.
  • reviewer summary: intent-alignment requires human: Delta re-review of 4ad3e30..b4fa5f1 (intent-alignment). The delta is a docs-only citation refresh across six src/docs/api-reference*.md files: server.go line refs shifted +1 (e.g. 1833->1834 ... 1928->1929) and api_review_event_dispatch.go:16->15. I verified all 17 refreshed citations against the files at head (src/pkg/dashboard/server.go:1834-1929 route registrations, api_review_event_dispatch.go:15 registerReviewEventDispatchRoutes) and they resolve; changelog-fragment-guard and 'relative links and anchors resolve' both pass at this head. No code touched, so intent alignment against πŸ› [v6] hosted hives reject every relayed GitHub webhook: the hub never gives the spoke a way to verify themΒ #17910 is unchanged from the prior head: the PR implements option 2 (per-hive hub relay key) as the issue recommends, with documented deviations (no admin rotation endpoint, redelivery-within-10m treated as replay) that fall within the issue's 'write the reasoning in the PR body' latitude. Previous findings: [docs-currency] server.go:110 citation drift -> FIXED by this delta. [security] src/pkg/hub/webhook_relay_key.go:104 new long-lived relay credential on public webhook endpoint needs approver sign-off -> STILL PRESENT (file untouched in delta); it keeps the whole-PR verdict at requires_human. No new in-scope or out-of-scope findings from this perspective.
  • reviewer summary: security requires human: Delta 4ad3e30..b4fa5f1 is docs-only (68 lines, six src/docs/api-reference*.md files, all server.go/api_review_event_dispatch.go citation line bumps); no code, workflow, or permission change, no new security findings. Prior [security] finding at src/pkg/hub/webhook_relay_key.go:104 is still present (file unchanged; no approver sign-off recorded) and keeps the verdict at requires_human. Prior [docs-currency] server.go:110 citation drift appears fixed by this delta.
  • reviewer summary: style requires human: Delta re-review at b4fa5f1 (vs 4ad3e30): one commit, docs-only, a +1 line-number resync of 22 pkg/dashboard/server.go:NNNN citations across src/docs/api-reference.md and five api-reference/*.md shards. Verified each new citation (1834-1836, 1842, 1847-1848, 1851-1858, 1863, 1929) against server.go at head: all resolve to the named route registrations. Repository idiom (file:line citations in the API table) is followed; no new style/maintainability findings. Prior findings: [docs-currency] citation drift / changelog-fragment-guard / Docs Link Check β€” FIXED (both changelog-fragment-guard and relative links and anchors resolve pass at head). [security] src/pkg/hub/webhook_relay_key.go:104 new long-lived relay credential needs approver sign-off β€” STILL PRESENT (file unchanged in delta; in-scope, keeps the whole-PR verdict at requires_human; owned by the security perspective, not re-reported here). No comment posted from this perspective.
  • the automerge lane will not merge this unattended

Head: verdict requires_human @b4fa5f1, 70/72 checks green, 2 pending, DCO yes, soak 0s of 10m0s.

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

@clubanderson

Copy link
Copy Markdown
Member

/hive decision option 2 accepted (see my review). Cherry-pick v5 commits 9bbd5f4, 2ff9d29 and f3f5cb3 from #17914 onto this branch so saveSaaSHive in src/pkg/hub/saas_provision.go writes meta.json 0o600 under a 0o700 dir with the same tests, then push; I will approve once green.

@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/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue labels Nov 12, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Decision recorded by @clubanderson for head b4fa5f1. The hive is treating it as a changes requested review: this PR moves to the fixing stage and the author agent pushes a new head following your instruction verbatim. The review swarm then re-reviews that head; if it approves, the PR comes back for your merge approval.

hivecommons-hive Bot and others added 3 commits November 12, 2026 10:52
…ub secrets

SaaSHive.WebhookRelayKey is serialised into saasHivesDir/<id>/meta.json,
which saveSaaSHive wrote 0o644 under a 0o755 directory. The record carried
no key material before this PR; the hub's other secret stores (cluster App
keys, generation stores, session revocation) and the spoke-side relay key
file all use 0o600/0o700. A locally leaked relay key would let an attacker
forge deliveries to that hive's public /api/webhook/github.

Write meta.json 0o600, create the hive directory 0o700, and best-effort
chmod pre-existing directories so hives provisioned before this change are
tightened on their next save. Add a regression test covering both modes.

Hive-Fix-Attempt: 2/6
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
(cherry picked from commit 9bbd5f4)
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Hive-Fix-Attempt: 2/6
saveSaaSHive forced the hive directory to 0700, which re-added owner-write
to directories the reset-assignment tests lock to 0555 to simulate a failed
persist, so TestHandleResetAssignmentReportsSaveFailure and
TestSweepStuckAssignmentsSkipsWedgeWhoseSaveFails no longer saw the failure.
Strip only group/other bits so legacy 0755 dirs still become 0700 while a
deliberately read-only dir keeps failing the write.

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
(cherry picked from commit 2ff9d29)
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Hive-Fix-Attempt: 2/6
TestSaveSaaSHiveKeepsRelayKeyPrivate and TestSaveSaaSHiveNeverWidensReadOnlyDir
swapped saasHivesDir for t.TempDir() inline even though the file already
defines useTempSaaSHivesDir for exactly that. Use the helper like the
sibling tests do.

Hive-Fix-Attempt: 3/6
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
(cherry picked from commit f3f5cb3)
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Hive-Fix-Attempt: 2/6
@hivecommons-hive hivecommons-hive Bot added stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) 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 stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 12, 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.

Style/maintainability pass at a8a6ac0 β€” no blocker; one advisory.

PR body omits an on-disk permission change. src/pkg/hub/saas_provision.go:2090-2105 now creates hive record dirs 0o700 (was 0o755), strips group/other bits from pre-existing dirs on every save (:2097), and writes meta.json 0o600 (was 0o644). The body's "What changed" / "Storage" sections only say the key lives in meta.json. Anything outside the hub process that read hive records (backups, sidecars, another uid) silently loses access after the first save. Please add this to the PR body so operators see it in the changelog trail.

Minor, no action needed: the relay wire format (header names, MAC layout, sha256: fingerprint) is implemented three times β€” src/pkg/hub/webhook_relay_key.go:34-70, src/pkg/dashboard/webhook_relay.go:30-57, src/pkg/github/webhook_relay_key.go:122-130. That matches the existing hub/spoke mirrored-type convention, and the cross-package tests pin it, so it's consistent with the tree β€” just something to keep in sync on any future change.

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

@clubanderson clubanderson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hardening commits now match v5 (#17914); v5/v6 pair equivalent. /lgtm /approve

@clubanderson

Copy link
Copy Markdown
Member

/lgtm
/approve

@kubestellar-prow kubestellar-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Nov 12, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 78a0fd1ffd53dc0812b0262622e7d897b02c0649

@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: clubanderson

The full list of commands accepted by this bot can be found here.

The pull request process is described 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

@clubanderson
clubanderson merged commit df96695 into v6 Nov 12, 2026
88 of 90 checks passed
@kubestellar-prow kubestellar-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 12, 2026
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-17910 branch November 12, 2026 17:02
@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. 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. lgtm Indicates that a PR is ready to be merged. role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. stage/050-review-pending Review swarm requested; awaiting a verdict for the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

πŸ› [v6] hosted hives reject every relayed GitHub webhook: the hub never gives the spoke a way to verify them

1 participant