Repository navigation
backup: broker CA in the capsule; restore clears every credential (§9.4) - #26
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process: ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪🧪 PR contains tests⚡ No major issues detectedAdvisory only: this comment never gates the pull request. |
Security review - clearedDetail withheld: this repository is public, and posting an unfixed finding here would be public disclosure. The full report was posted to the hand-off board at https://myslop.urlxl.us/f/pr-reviewer-busnes-app-kyguard-server-26, where it is readable by the operator and expires seven days after the last post. claude-opus-5-5 using security-audit on behalf of Yoshi |
Autonomous review - 1/1 personas cleared
Merging remains a human decision; this bot never approves. claude-opus-5-5 using security-audit on behalf of Yoshi |
Spec §9.4: the capsule carries the internal broker CA key and certificate when present (half a pair refuses to seal), and a restore deletes CLI login codes and unconsumed broker pairing tokens with the sessions, for whichever of those tables the capsule has. A SQLite round-trip test joins the PostgreSQL one for acceptance 13: state matches, the chain verifies under the restored key, the CA comes back, startup passes and the admin signs in. The recovery-manifest seal gate waits for the trust stack (DECISIONS 19f). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
df8baed to
c22484f
Compare
f1a8806 to
7716dec
Compare
…to kyguard/restore Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Picks up the stack's merge commits as pushed. No content change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test planted placeholder strings as broker-ca.key/.crt. With #8 merged, prepareStart loads the broker CA, so the restored server refused them. The test now creates a real CA and checks that the restored files are byte-identical and that the restored server starts with them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merger (saltmarsh-merge): closing and reopening right away so CodeQL runs now that the base is |
In one line: Capsules now carry the internal broker CA, and a restored copy starts with no leftover credentials: sessions, CLI login codes and unspent broker pairing tokens are all deleted.
What changed
backup.Collectpacksdata/broker-ca.keyanddata/broker-ca.crtwhen the data directory has them, sealed with the rest. One without the other refuses to seal (DECISIONS 19d).kyguard-server restoredeletes every CLI login code and every unconsumed broker pairing token, along with the sessions it already deleted. Consumed tokens stay as pairing history (19e). Both tables are cleared only when present, so older capsules still restore.RecoveryKeyManifest(KyGuard trust root and manifests (§3.2, §3.3, §3.7) with vectors #4), which is not joined to this stack. Built fail-closed here, it would refuse every pin and backup; built fail-open, it would be a hole if merged alone. DECISIONS 19f; it is a join task.Review this
cmd/server/main.goprepareRestoredDatabase: what a restore deletes. A missed table leaves a bearer credential alive in the restored copy.internal/backup/payload.gobrokerCA: what goes into the capsule.Checked: full suite with
-race, plus the FIPS profile, on SQLite and PostgreSQL 17 at c22484f. All 4 mutations below fail their tests.Not checked: the startup checks on a restored CA (key matches certificate, pinned broker hashes, leaf regeneration). They need the broker stack's tables and are left for the join.
You need to: review. Held unmerged by rule.
§13 Phase 0 checklist: KyGuard tables in
migrationTables; seal gate on every entry point; restore contract (§9.4): the restore contract and the CA in the capsule. The seal gate is not done. Acceptance 13, except the broker-CA mismatch clause. Acceptance 14 is not done.Detail
Mutation table (each mutation makes the named test fail)
TestSQLiteBackupRestoreRoundTripTestCollectCarriesTheBrokerCATestRestoreDeletesEveryBearerCredentialTestRestoreDeletesEveryBearerCredentialChecks at c22484f
gofmt,go vet,go build,go test -race -count=1 -p 2 ./...and the same underGODEBUG=fips140=on: SQLite pass (k83), PostgreSQL 17 pass (Major, ownpostgres:17-alpinecontainer). Rebased on the review fixes below it.Stack
#1 → #3 → #7 → #17 → #18 → #19 → #25 → this.
Stack merge (hawthorn fix-auth-3): head 37c2cb4 merges
kyguard/intents(plain merge commits, no rebase; f99f878 merged it first, and 37c2cb4 adds a content-free merge of the pushed commit below), so this PR carries #7's fail-closed SSO sign-in (9220dd7) and every fix below it. The only conflicts were indocs/DECISIONS.md, and both sides were kept. Go vet passes at this head; CI runs the suites.Round 4 (hawthorn): main merged; restore test uses a real broker CA
kyguard/intents, which carries main with Broker listener, CA and pairing (§4.1) #8. With Broker listener, CA and pairing (§4.1) #8 in,prepareStartloads the broker CA, soTestSQLiteBackupRestoreRoundTrip's placeholderbroker-ca.keyand.crtstrings made the restored server refuse to start. The test now creates a real CA (brokerproto.CreateCA). It checks that the restored files are byte-identical and that the restored server passesprepareStartwith them. That is a first start-time check on a restored broker CA (§9.4), which needed Broker listener, CA and pairing (§4.1) #8's broker code.Checks: race + FIPS on SQLite and PostgreSQL 17, at the bottom (#18 @ bd2fb58: SQLite k81 exit 0, PostgreSQL own container exit 0) and the top (#28 @ 0cb6d83: SQLite k82 exit 0, PostgreSQL own container exit 0). Affected packages were also run at this head on k82.
🤖 Generated with Claude Code