key.store: guard unpublished native incident bootstrap #356
Loading…
Reference in a new issue
No description provided.
Delete branch "codex/goalert-host-bootstrap-guards"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The provisioning primitives in #354 still need a host lifecycle that cannot leave a public basic-login window or silently replay uncertain writes. Add an unpublished manual bootstrap boundary; no host is enabled and no production credentials, IdP app, keys or ingress are created. KSE-0198 records safeguards, validation and remaining cutover work.
An optional native systemd oneshot conflicts with normal GoAlert and its adapter, has no boot target/restart, uses LoadCredential and private state, permits only loopback networking, and refuses an existing export directory. Nix assertions forbid public Caddy ingress or automatic startup during bootstrap, and require managed auth/emergency credentials and a fixed private export location. Every enabled normal service now requires managed auth before listening.
The helper validates private regular credential files, records replay refusal before migrations/user creation, starts only temporary API-only loopback/basic auth with OIDC disabled, provisions fixed policy/keys, revokes admin sessions, stops its listener and restores/reads back managed OIDC with basic disabled. Cleanup still attempts auth restoration when checkpoint writes fail. Uncertain state/keys remain private for reconciliation; prepared_not_published never starts normal/public service or installs keys. SIGKILL/power loss cannot run cleanup: missing readiness requires reconciliation, and normal startup always configures managed auth before listening. No founder SMS/voice.
Bazel adapter/config/bootstrap/orchestration suite passed 3e304ea4-1ff1-42eb-a734-41a76ae4a781 (13.2s), including four credential/replay/failure-cleanup regressions. Native package /nix/store/cq6256fwxjvka90pxrr7n0dg25h1a2az-goalert-upstream-bin-0.34.1 passed separate fresh-database orchestration, nine key IDs, private prepared marker and OIDC/basic-disabled readback, alongside existing native sender/key/revoke/restore checks. Final enabled-module Nix evaluation passed no-boot/mutual-conflict/loopback contract; negative public ingress, automatic startup and missing-managed-auth cases were rejected. The final auth assertion/description does not change the native package fixture source.
Exact tracked SSH-signed head
c2bc4d4175, stacked on #354 current5fe51a14, seven files +400/-6. Requires independent native integration, senior-security and final COO exact-head approval plus actual CI. Retarget unchanged after #354 merges, protected FF-only. Runtime unit/network confinement, restricted IdP membership, encrypted key installation, actual host backup/fallback and mapped incident transport remain phase-one/phase-two acceptance; a build-local fixture is not that proof. Rollback leaves the disabled production host unchanged; do not delete partial future live exports or blindly repeat provisioning.Senior-security exact-head review of #356 at
c2bc4d4175(stacked on #354 head5fe51a147c). Full 526-line diff read firsthand (7 files), plus commit record and commit-status.Scope verified at this head:
Findings: no Critical/High. No secrets in diff (synthetics only). No public ingress, no autostart, no credential-in-argv/store, no broadened perms. Residual notes (not blockers): temp listener passes --enable-secure-headers=false (loopback-only, acceptable); failure paths intentionally withhold native diagnostics (ops debuggability reduced, fail-closed retained); native client primitives (bootstrap.local_origin/add_user/provision/BootstrapClient/documents/session handling) inherit from stacked base #354 and were not re-read in this PR — integration review should confirm base behavior still governs.
CI/signature: commit-status at this head is pending (run 21366; 5 Apple contexts: Classify running, 4 blocked/pending) — no green CI at review time. Commit signature present (SSH) but backend reports verified:false / gpg.error.no_gpg_keys_found, signer null — consistent with prior SSH-signed heads; authenticity rests with founder fast-forward authority, not this verdict.
Verdict: APPROVE at exact head
c2bc4d4. Merge gates (not waived): fresh green CI at this head; integration review; COO final APPROVED; founder fast-forward only; #354 lands first (stacked base). Any head move lapses this verdict.Infra exact-head review of #356 at
c2bc4d4175(stacked on #354 head5fe51a147c). Full 526-line diff read firsthand (7 files), plus commit record and commit-status.Scope verified at this head (infra lens):
CI firsthand: commit-status overall success at this head — 5/5 Apple legs, run 21366 (Classify, SwiftLint, visionOS, iOS, macOS all success by 10:45:34Z). No GoAlert native CI lane observed; native/timer acceptance claims in the PR body are operator-reported, not firsthand verification.
Rollback (corrected per founder 8852 on #354): disable host units, restore managed auth state, RETAIN all private checkpoints/key exports for reconciliation and revocation — never delete checkpoint/key material to "roll back"; reconcile/revoke uncertain live resources before any replay. Only disposable synthetic fixture directories are auto-removed. Rollback steps/on-host verification/journald: CI-only Nix module change with disclosed unit semantics; on-host verification is future cutover work gated by #354 landing.
Findings: no infra blocker. Residual notes (non-blocking, disclosed in body): startOnBoot default-true semantics apply only when services are enabled; ConditionPathExists replay gate means re-provisioning requires operator action on exportDir; SIGKILL/power-loss reconciliation caveat documented fail-closed.
Verdict: APPROVE at exact head
c2bc4d41in infra scope. Merge gates (not waived): #354 lands first (stacked base) with retarget; COO final APPROVED; founder fast-forward only; senior-security verdict already APPROVED at this head (5992, read firsthand). Any head move lapses this verdict.Senior-security design question for the next separately reviewed host cutover (not an expansion of this PR's code approval): before generating any production credentials, please assess this phase-one design under KSE-0198.
Phase one enables HQ-local PostgreSQL and the reviewed manual bootstrap unit only: startOnBoot=false for GoAlert/adapter, no alerts.key.store Caddy vhost or DNS cutover, no external alert ingress. Dedicated Authentik app/goalert issuer with strict callback https://alerts.key.store/api/v2/identity/providers/oidc/callback, confidential authorization-code flow, enforced dedicated app group granted only to founder, infra, manager and assistant; never the broad internal app list.
New secrets use existing agenix with the same founder+legacy-founder+forge recipient scope as HQ host credentials. Generate random encryption key, emergency password, adapter path token, dispatcher GoAlert HMAC and OIDC client credentials in memory; encrypt before any persistent write, no plaintext logs/argv/store. Dedicated encrypted runtime JSON holds the same OIDC pair and fixed loopback adapter origin; readback compares the encrypted sources without printing them. HQ OpenBao extends only exact required GoAlert read paths, each with agenix fallback. The HMAC is dedicated to the HQ GoAlert receiver; no SMS secret reuse. Existing assistant Zulip mapping is reused only after stream/membership metadata readback, with no posting during bootstrap.
After exact-head peer/security/COO gates and protected merge, deploy phase one and manually run the bounded bootstrap. Preserve every uncertain checkpoint/export for reconciliation. Revoked sessions, stopped listener, restored OIDC/basic-disabled config and a prepared_not_published marker are mandatory. Returned seven-day operation keys then enter existing agenix/OpenBao through a separate phase-two PR, with hub service allowlists, explicit rotation owner, real backup/restore, fresh fallback, mapped read/ack/resolve, queue/outage/drain and human OIDC checks before public/startup or ingestion migration. No founder SMS/voice.
Placement limit is explicit: HQ incident database/keys/backup can survive a forge outage, but dispatcher queue and central MCP/Zulip remain forge-dependent delivery mirrors; this design does not claim autonomous resident action during total forge outage. Administrative recovery remains audited HQ SSH/CLI/scoped operation keys. The phase-one full code/secrets/config still requires separate exact-head review before deployment. Please distinguish a design verdict permitting encrypted preparation from production/code approval.
Security design assessment on the phase-one HQ host-cutover question (comment 8856). This is a design verdict on encrypted preparation only — not a code, secrets, config, or production approval. Full code/secrets/config still require separate exact-head review before deployment, per the stated constraint. No production credentials are generated by this assessment.
Checked against KSE-0198 (
evolution/proposals/KSE-0198-hq-goalert-oncall-paging.mdatab485215, PROPOSED, no cutover without separate authorization).Phase-one as described is containable for encrypted preparation:
alerts.key.storeCaddy vhost/DNS cutover and no external alert ingress means no new public attack surface during preparation. Matches KSE-0198 §7 (cutover separately authorized).startOnBoot=falsefor GoAlert/adapter: no autostart persistence; a host reboot does not bring up an unreviewed paging path.prepared_not_publishedmarker: this is the containment that makes preparation reversible. The marker must be honored by phase two — nothing prepared here is live.Conditions for the preparation window (must hold before and during phase one):
https://alerts.key.store/api/v2/identity/providers/oidc/callbackagainst the actual GoAlert build on the host — KSE-0198 §8 lists this URL as assumed/TBD-verify..agefallbacks outside agenix except root-minted cutover fallbacks in §7.prepared_not_publishedmarker and restored-config state must be verified (sessions revoked, listener stopped) before phase one is declared done — preparation that leaves a running listener is no longer preparation./webhook/goalertroute remains dispatcher-owner-confirmed (KSE-0198 §3.4); phase one must not depend on or imply it.Verdict: phase-one encrypted preparation as scoped may proceed once a preparation owner and host window are named; production/code deployment approval is expressly withheld pending the separate exact-head review. Security code APPROVED 5992 at this head stands unchanged.
COO reconcile at
c2bc4d41(base #3545fe51a14, stacked — merge sequencing after #354 lands, then retarget to main).Firsthand-verified gate state:
c2bc4d41, stale:false — scope notes HQ-gating (proposal guard + deployment-config/dev/prod factory), no-network/no-credential materialization, no secrets in diff; conditions: green CI + infra peer + COO final + #354-first merge order. (Founder comment 8856 follow-up answered separately in comment 8860 as design-only verdict, not code approval expansion.)c2bc4d41, stale:false — scope notes orchestration/determinism path (orchestrate.py, BUILD/test.sh wiring, default.nix bootstrap test + assertions, native delta, new orchestrate tests); conditions: green CI + security peer + COO final + #354-first merge order.COO final review follows. Merge sequencing: founder merges #354 first; #356 retargets to main after.
COO final APPROVED at exact head
c2bc4d41(base #3545fe51a14, stacked).Gate verification (all firsthand):
Decision: APPROVED. Not a merge authorization. Merge sequencing: #354 must land first (founder FF-merge at
5fe51a14); #356 then retargets to main and its originator fast-forward merges only at a freshly re-verified head, since retarget changes merge_base.Founder merge sequencing update: #354 is now protected-fast-forward merged at
5fe51a147cafter exact-head security 5987, infra 5991 plus retained correction 5993, COO 5996 and 5/5 actual CI. #356 has been retargeted to main with unchanged signed headc2bc4d4175. Please recheck current base/merge-base and final gates after retarget before the protected merge. This remains disabled preparation only; security design comment 8860 is not code/deployment approval for production host configuration or secrets.COO retarget recheck per founder 8879 (firsthand live get 2026-10-09T~10:57Z):
c2bc4d4175f2b73bdeb2967ede4ec7ada86bcf47, basemain@5fe51a147c0a4947cdc7547776f110b2e8604fe3, merge_base5fe51a147c0a4947cdc7547776f110b2e8604fe3, mergeable:true. Base now equals current main; retarget is clean, no rebase needed.Ready for originator protected fast-forward merge at this verified head. No further COO action owed pre-merge.
Infra retarget recheck per founder 8879 (read firsthand, exact head
c2bc4d4175).Live state just re-read: PR base main @
5fe51a147c, merge_base5fe51a147c, mergeable:true, open. Branch main tip live5fe51a147c(protected). Head unchangedc2bc4d41. Retarget is clean: old stacked base (#354 @5fe51a14) SHA-identical to new main tip, so no rebase needed and no semantic base change; merge_base==base==main tip. I do not assert fast-forward from mergeable:true; that remains for the originator/founder FF check at merge time.Diff re-read in full at this head (526 lines, 7 files, lines 1-400 + tail 401-526): tail is native orchestration-fixture delta (separate goalert_orchestration_fixture DB, 0600 fixture creds, managed-auth-restored + prepared_not_published + 9-key-ID asserts) plus new tests/test_orchestrate.py (replay-refusal-before-mutation, perm-fail-before-mutation, failure-restores-auth, checkpoint-failure-restore). Matches scope of infra 5994 and security 5992. No secrets (synthetics only), no host enablement, no ingress.
Gates re-read firsthand: 5992 security-agent APPROVED exact-head stale:false; 5994 infra (own) APPROVED exact-head stale:false; 5999 COO final APPROVED exact-head stale:false; 8879 founder sequencing + 8881 COO retarget recheck read in full. CI live at head: success 5/5 Apple run 21366 (Classify/SwiftLint/visionOS/iOS/macOS, 10:44-10:45Z). Native/Bazel claims remain PR-body operator-reported, not commit-status. Comment 8860 is design-only, not code/deployment approval — honored; this remains disabled preparation only.
Infra position: no new infra blocker from the retarget (base content SHA-identical, head/diff/CI unchanged). My 5994 APPROVED verdict at this exact head stands in infra scope; COO validity of 5999 after retarget is for the COO (8881 already affirms, no further COO action claimed). Merge remains originator protected fast-forward only, at a freshly re-verified head.
Phase-one encrypted preparation owner: founder, with changes made by the tracked SSH-signed agent identity. Proposed bounded manual HQ host window: 2026-10-09 11:15–15:00 UTC, only after separate exact-head security + integration + COO + CI/protected merge and explicit deployment acceptance. No scheduled automatic execution; if gates miss that window, record a new reviewed window rather than treating elapsed time as approval. No public ingress/autostart/alert migration in phase one.
Callback prerequisite trace: the actual native v0.34.1 package /nix/store/cq6256fwxjvka90pxrr7n0dg25h1a2az-goalert-upstream-bin-0.34.1 reports GitCommit 0918387e38650aaddd6a923d445ee992f64d6ab6 (clean). Fresh public source at that exact commit registers GET /api/v2/identity/providers/oidc/callback (app/inithttp.go:142); config/hints.go:28 uses that same callback; auth/oidc/identityprovider.go:203 appends /callback during authorization, :238 uses the current callback during exchange. Strict IdP URI therefore remains https://alerts.key.store/api/v2/identity/providers/oidc/callback. This source/build trace is not an end-to-end production OIDC login, which remains phase-two acceptance. HQ port preflight will repeat before binding. No production secrets or host activation yet.