Skip to content

✨ hub: provision the per-hive customer match key to hosted spokes - #19249

Open
hivecommons-hive[bot] wants to merge 4 commits into
v5from
scanner/fix-19246
Open

hivecommons-hive[bot] wants to merge 4 commits into
v5from
scanner/fix-19246

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Hub-hosted spokes never hold the master, so the customers hub import found no match key and stayed inert. The hub now derives customerMatchKey(currentMaster, hive) and injects it as HIVE_CUSTOMER_MATCH_KEY at provisioning and in the per-hive env reconcile, so a rotation converges spokes to the current generation. Tests pin the injected key to customerMatchKey and the reconcile set. Self-service byo- hives hold no master; decision: they cannot use the hub import in v1, documented in the design doc. Default behaviour is unchanged (import stays off unless enabled and consented). Closes #19246

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

…okes

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

@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 new key derivation against customer_match.go:51, the reconcile path in perhive_env_reconcile.go and the provisioning template. Looks correct to me, and it matches what #19246 scopes: the key is customerMatchKey(provisionCurrentSecret(), hiveID), it is per-hive, it follows the current generation on reconcile, and the byo- decision is documented per the issue's second option.

Two things for whoever merges, neither a blocker:

  • The provisioning template line (saas_provision.go:3689) has no test that renders it. The new tests cover desiredPerHiveEnv and provisionCustomerMatchKey, so a typo in the {{.CustomerMatchKey}} field name would only fail at deploy time. Suggestion only.
  • Adding an env name to perHiveEnvNames() makes the reconcile patch every hosted Deployment once, which I expect rolls each spoke pod. I did not verify the rollout behaviour; worth knowing before the hub upgrade.

I could not find the spoke-side reader (SpokeCustomerMatchKey from the issue) in this tree at this head, so until it lands the injected env var is unused. That is harmless.

I have not approved or closed anything.

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

// symmetric; per-hive so an invite link cannot travel between tenants.
"InviteKey": provisionInviteKey(h.ID),
// Per-hive customers hub import match key (HIVE_CUSTOMER_MATCH_KEY).
"CustomerMatchKey": provisionCustomerMatchKey(h.ID),

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.

Nothing renders the template with this field. A typo between this map key and {{.CustomerMatchKey}} at line 3689 would be a template error at provision time, not a test failure. A small render test asserting HIVE_CUSTOMER_MATCH_KEY appears with provisionCustomerMatchKey(h.ID) would close it. Suggestion, not a defect.

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

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

Code looks correct to me; routing only because this provisions a new derived credential to spokes.

Verified against the tree at the PR head:

  • provisionCustomerMatchKey (src/pkg/hub/hub_keys.go) is customerMatchKey(provisionCurrentSecret(), hiveID), the same derivation the hub verifies in customerMatchKeys (src/pkg/hub/customer_match.go), so the spoke and hub agree on the current generation.
  • The key is added to the three places every other per-hive key lives: the provisioning template data and manifest (saas_provision.go), desiredPerHiveEnv and perHiveEnvNames (perhive_env_reconcile.go). Tests cover current-vs-previous generation, per-hive uniqueness and rotation convergence.
  • The spoke side already reads HIVE_CUSTOMER_MATCH_KEY (src/pkg/hub/spoke/keys.go), so the name matches.

Why a person should look: the key is a per-hive HMAC secret, written in clear as a Deployment env value like HIVE_INVITE_KEY, and adding it to perHiveEnvNames means the reconcile will report drift on, and presumably patch, every existing hosted spoke. That is a fleet-wide rollout side effect, not just new-hive behaviour. Both are consistent with existing keys, so this is a sign-off, not a defect.

hive/awaiting-ci: CI pending - sweep will merge when green. Fixed the F19 wiring test count floor (it did not assert the new customer match key) and merged v5.


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

@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 19, 2026
…ixture

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.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 19, 2026
… wiring test

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 19, 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.

Decision needed: @clubanderson should decide whether injecting a new derived credential (HIVE_CUSTOMER_MATCH_KEY) into every hub-hosted spoke, and rolling the whole fleet once to converge it, is acceptable to land now?

The code looks correct to me; I am routing only because it adds a new per-hive derived credential to the spoke deployment template and the fleet reconcile, which is a credentials/deploy surface.

Verified against the tree:

  • provisionCustomerMatchKey (hub_keys.go) is customerMatchKey(provisionCurrentSecret(), hiveID), the same formula the hub verifies with in customerMatchKeys (customer_match.go:69), so provisioning and reconcile agree and the sweep will not fight itself. It returns "" for an empty master or hive id, and the existing fail-safe in desiredPerHiveEnv skips such hives rather than writing an empty var.
  • The key is HKDF-style per-hive (infoCustomerMatchKey), not the master, so a spoke compromise does not expose other tenants' keys. It matches the HIVE_INVITE_KEY pattern the issue (#19246) asked for.
  • The tests update the exact-count rotation and reconcile tests (hub_generations_f19_wiring_test.go, perhive_env_reconcile_test.go), so a dropped entry in perHiveEnvNames fails.

What a maintainer should know:

  • Adding the var to perHiveEnvNames() makes every existing spoke show drift (var absent), so the rate-limited reconciler will patch and roll every hub-hosted spoke once (3 per 15-minute cycle per the comment in perhive_env_reconcile.go). That is expected for this design but is a fleet-wide pod roll to ship an import that is off by default.
  • Minor: the comments at perhive_env_reconcile.go:77 ("five security env vars") and :184 ("five ALWAYS-PRESENT") are now stale; the list has six entries.
  • Self-service byo- hives get no key; the design doc states they cannot use the import in v1, matching option 3 in the issue.

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

@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 @60bd2a1
  • the review found: the reviewer marked this change high-risk
  • reviewer question: @clubanderson should decide whether a derived per-hive match key may be injected as a plaintext env var into every hub-hosted spoke, including a fleet-wide reconcile of existing deployments?
  • the automerge lane will not merge this unattended

Head: verdict requires_human @60bd2a1, 79/79 checks green, DCO yes, soak 0s of 10m0s.

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

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

PR Title Relation Files
#19253 ✨ customers: hub import disclosure, docs and consent views same files src/docs/design/customers-hub-consent.md

@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

Copy link
Copy Markdown
Contributor Author

/approve

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

/hive decision approve #19249: 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 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. 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/M Denotes a PR that changes 30-99 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.

[scanner] Customers hub import: provision the per-hive match key to hub-hosted and byo spokes

0 participants