Repository navigation
fix: generate console JWT secret at first boot, not in git - #240
hivecommons-hive[bot] wants to merge 1 commit into
Conversation
The kubestellar-console-github-oauth Secret committed a usable jwt-secret (default-jwt-secret-123456789012345678901234). JWT_SECRET signs console session tokens, so a value published in git lets anyone forge valid sessions on every default install. Mirror the kubeflex-postgres pattern (#98): the committed 01- manifest now creates only the namespace, and a first-boot generator writes 02-kubestellar-console-secret.yaml with a random 256-bit jwt-secret and empty OAuth credentials (consumed with optional: true). Idempotent, 0600, runs from k0s-first-boot.service before k0scontroller starts. Existing installs rotate on upgrade: tmpfiles C+ replaces the stale 01- copy (dropping the published Secret) and the generator creates the 02- file fresh, invalidating any tokens forged with the public value. Closes #72 Assisted-by: Claude Fable 5 via GitHub Copilot Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: sec-check[bot] <sec-check[bot]@users.noreply.github.com>
|
Important Held for human review by the hive's ACMM level gate. This PR was opened by the "sec-check" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the Hive will automatically remove the |
CI status: failure is a
|
Baseline failure root-caused — fix is #241The #241 renames the presets to
|
|
The failing No push needed on this branch: once #241 lands, this PR needs only a re-run of
|
|
Triage for the red
Plan: land #241 first (plus whatever its diagnostics surface), then rebase/rerun this PR — no changes needed here. Not pushing empty commits to retrigger.🐝 Hive Agent: — hive: agent=sec-check backend=copilot model=claude-fable-5 copilot=1.0.88 |
|
CI status: this PR's Fix chain lives in #241: the
|
|
Superseded: the entire diff of this PR (generate-console-secret.sh, k0s-first-boot.service hook, k0s-sysext.bst chmod, manifest change, and tests/unit/test_k0s_manifests.py) landed on main verbatim in #243 (b81de1a) — |
Security Fix
files/k0s/manifests/kubestellar/01-kubestellar-console-github-oauth.yamlcommitted a usablejwt-secret(default-jwt-secret-123456789012345678901234). The console consumes it asJWT_SECRETwithoptional: false, so every default install signs session tokens with a key published in this repository — anyone can forge valid console sessions.What this changes
01-kubestellar-console-github-oauth.yamlnow creates only thekubestellar-consolenamespace; the Secret is no longer committed.files/k0s/kubeflex/generate-console-secret.sh(mirrors thekubeflex-postgrespattern from [sec-check] kubestellar postgres StatefulSet hardcodes superuser password 'kubeflex' as plaintext env, auto-applied by default #98): at first boot it writes/var/lib/k0s/manifests/kubestellar/02-kubestellar-console-secret.yamlwith a random 256-bit hexjwt-secretand empty OAuth keys (the console readsclient-id/client-secretwithoptional: true). Idempotent, mode 0600, sorts before40-kubestellar-console.yaml.k0s-first-boot.serviceruns the generator after the postgres one, beforek0scontrollerstarts.elements/oci/k0s-sysext.bstchmods the new script alongside the postgres generator.tests/unit/test_k0s_manifests.py: executed coverage — nokind: Secret/jwt-secretin the committed manifest, generator ordering in the unit, and an idempotency run asserting the 64-hex secret, 0600 mode, and stable re-run output.Upgrade behavior
Existing installs rotate naturally: tmpfiles
C+replaces the stale01-copy (dropping the published Secret from the stack) and the generator creates the02-file fresh, invalidating tokens forged with the public value. Operators enabling GitHub OAuth edit the generated Secret in place.Validation
python3 -m pytest tests/unit -q— 335 passed, 1 xfailed.Closes #72 (merging leaves nothing for the issue to track: the usable secret is gone from git and rotation of previously deployed values happens on upgrade)
Filed by sec-check agent (ACMM L4/L5 — hold-gated mode). Hold-gated: human review required.
— hive: agent=sec-check backend=copilot model=claude-fable-5 copilot=1.0.88