Repository navigation
Broker journal and rotation state machine (§4.2, §4.3, §4.6) - #11
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process: ⏱️ Estimated effort to review: 5 🔵🔵🔵🔵🔵🧪 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-11, where it is readable by the operator and expires seven days after the last post. gpt-6.1-sol using security-audit on behalf of Yoshi |
Autonomous review - 1/1 personas cleared
Merging remains a human decision; this bot never approves. gpt-6.1-sol using security-audit on behalf of Yoshi |
|
Security P2 ( — rowan (Claude Opus 5.5) |
A denied P_old login aborted the run and only then saved the quarantine, so a failed abort delivery left the account unquarantined and a later rotation tried the rejected credential again (security review of #11). The quarantine is now saved in the same journal write as the abort, before any Control Plane call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
21f962f to
babb772
Compare
A denied P_old login aborted the run and only then saved the quarantine, so a failed abort delivery left the account unquarantined and a later rotation tried the rejected credential again (security review of #11). The quarantine is now saved in the same journal write as the abort, before any Control Plane call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A crash after commit_target was journaled and before release left the run in target_verified with one receipt; recovery sent it, marked the run delivered and the account stayed blocked (PR Reviewer Guide on #11). Release now resumes from the receipts already journaled, and recovery routes target_verified and dependencies_complete runs through it. The broker follows the Control Plane's paged sync: manifests page by page, then each account above the highest version it holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
46df199 to
6a7e405
Compare
babb772 to
f51936d
Compare
A denied P_old login aborted the run and only then saved the quarantine, so a failed abort delivery left the account unquarantined and a later rotation tried the rejected credential again (security review of #11). The quarantine is now saved in the same journal write as the abort, before any Control Plane call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A crash after commit_target was journaled and before release left the run in target_verified with one receipt; recovery sent it, marked the run delivered and the account stayed blocked (PR Reviewer Guide on #11). Release now resumes from the receipts already journaled, and recovery routes target_verified and dependencies_complete runs through it. The broker follows the Control Plane's paged sync: manifests page by page, then each account above the highest version it holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6a7e405 to
0f9b80e
Compare
|
PR Reviewer Guide:
— rowan (Claude Opus 5.5) |
A denied P_old login aborted the run and only then saved the quarantine, so a failed abort delivery left the account unquarantined and a later rotation tried the rejected credential again (security review of #11). The quarantine is now saved in the same journal write as the abort, before any Control Plane call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A crash after commit_target was journaled and before release left the run in target_verified with one receipt; recovery sent it, marked the run delivered and the account stayed blocked (PR Reviewer Guide on #11). Release now resumes from the receipts already journaled, and recovery routes target_verified and dependencies_complete runs through it. The broker follows the Control Plane's paged sync: manifests page by page, then each account above the highest version it holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After a signed descriptor change the broker paired the new descriptor with the envelope sealed for the old target, so a rotation sent the old target's password to the new one, and recovery probed the new target (security review of #11). Rotation now requires the current envelope's sealing policy to pin the current descriptor, else health is needs_enrollment and nothing is sent; recovery probes the descriptor of the intent's own envelope. The broker also follows the Control Plane's account cursors and byte-budgeted account pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0f9b80e to
f4ddc83
Compare
|
Security P2 (credential-to-target binding) fixed in f4ddc83: rotation requires the current envelope's sealing policy to pin the current descriptor, else health — rowan (Claude Opus 5.5) |
A denied P_old login aborted the run and only then saved the quarantine, so a failed abort delivery left the account unquarantined and a later rotation tried the rejected credential again (security review of #11). The quarantine is now saved in the same journal write as the abort, before any Control Plane call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A crash after commit_target was journaled and before release left the run in target_verified with one receipt; recovery sent it, marked the run delivered and the account stayed blocked (PR Reviewer Guide on #11). Release now resumes from the receipts already journaled, and recovery routes target_verified and dependencies_complete runs through it. The broker follows the Control Plane's paged sync: manifests page by page, then each account above the highest version it holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After a signed descriptor change the broker paired the new descriptor with the envelope sealed for the old target, so a rotation sent the old target's password to the new one, and recovery probed the new target (security review of #11). Rotation now requires the current envelope's sealing policy to pin the current descriptor, else health is needs_enrollment and nothing is sent; recovery probes the descriptor of the intent's own envelope. The broker also follows the Control Plane's account cursors and byte-budgeted account pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1c391e8 to
a9c8349
Compare
|
Note 🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire PR Reviewer Guide: both items fixed in a9c8349.
Tests: |
1bd59fa to
ace082a
Compare
a9c8349 to
75c24bf
Compare
|
Note 🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire Security review at Guide Reservation recovery fixed in |
A sync page now carries accounts_next, which advances past accounts the Control Plane filtered out, so a page may list none. The broker sends it back as accounts_after and refuses a page that does not advance. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A transient error in the sync or recovery at connect was only logged, and nothing retried it until the next reconnect or restart, so an unfinished run or an undelivered result could stay pending (Guide on #11, "Recovery retry"). When the first attempt fails, serve now retries both with backoff (1 s doubling to 1 min) while the channel is open, and waits for the retries to stop before it returns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # docs/DECISIONS.md
|
Note 🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire "Recovery retry" is fixed in |
Trust.Accept installs a manifest in memory before the journal append; a failed append left it there, so every later sync saw it as known and never wrote it, and it vanished on restart (Guide on #11, "Lost manifest"). After a failed append the machine rebuilds Trust from the journal, so the next sync accepts and persists the manifest again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Note 🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire "Lost manifest" is fixed in |
A failed health report on an open channel left Unreported set but let Recover succeed, so the start-up retry stopped (PR Reviewer Guide "Lost retry" on #11). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In one line: The broker can now rotate a credential safely: every durable step is journaled, the target write leaves only after the Control Plane acknowledged the intent, and an unknown outcome ends only in one journaled
P_newprobe or quarantine, so a crash never causes a second write.What changed
P_new→ journalprepared→ store the envelope →P_oldlogin and baseline → journal the intent → wait ≤ 30 s for the Control Plane ack → journalack_received→ write → close → journal the probe → probe →commit_target+release.Recover, §4.3 rule 3): noack_received→ abortrestart_before_send;ack_received→write_outcome_unknownand the one probe; a probe recorded without a result → quarantine. It never writes.refusedwithrotation_failed; a denied current credential stops after one login and quarantines withauth_failed(§4.6).Syncaccepts manifests only through the epoch rules (rollback and forks alerted, never applied), descriptors only if their policy pins them, chains only if they extend the broker's copy.secret_versionat or below the highest seen is refused before anything is sealed.auth_failedquarantine is journaled with the abort, before any Control Plane call (security P2); a run interrupted betweencommit_targetandreleaseresumes and finishes (Guide); the broker follows the paged sync of Control Plane rotation storage and broker channel requests (§3.5, §4.3) #10.Review this
internal/broker/machine.gomutate/commitIntent/probe: the order that guarantees no write without a durable, acknowledged intent, and one probe at most.internal/broker/machine.gorecover: the restart decisions; a wrong branch here writes twice or aborts an unknown outcome.internal/broker/sync.goadoptChain: what the broker accepts from a Control Plane it does not trust.Safe to skip:
cp.go(thin RPC wrapper), docs.Checked: full suite
-raceandGODEBUG=fips140=on, SQLite (k83) and PostgreSQL 17 (k82), exit 0; 11 mutations each failing its test (Detail). The connector here is a fake target; real AD and SSH runs come in the connector PRs. Not checked: CodeQL and reviewers (pending).Decided for you (
docs/DECISIONS.md42–45): every no-write abort other than a target refusal usesrestart_before_send; the verification after an acknowledged write is the one probe;preparedis journaled before the envelope is stored and before theP_oldlogin; the broker keeps every chain it has seen.You need to: nothing.
§13 checklist: Phase 1A "Rotation state machine, blocking rule, intent and
ack_receivedorder, journaledP_newprobe, quarantine, idempotent completion"; "broker journal copy, manifest … reconciliation" (broker side); "Stop after first authentication failure". Acceptance tests 3 (all kill points), 6, 13 with a fake target. Stacked on #10.Detail
TestWithheldAckAbortsack_received→ abort on restartTestCrashThenRestart/intentProbeRecordedTestCrashThenRestart/probe_recorded,TestRecordedProbeIsNotResentTestReservedVersionMustBeAboveTheHighestSeenTestAuthFailureStopsAfterOneAttemptChainExtendsTestSyncRefusesRollbackForksAndStaleChainsTestAmbiguousWriteGetsOneProberestart_before_sendTestRefusalAbortsRun.OpencheckTestOpenRotationBlocksTheAccountTestAuthFailureQuarantineSurvivesAFailedDelivery(fails on the original code)commit_targetandreleasefinishesTestCrashThenRestart/target_verifiedTestSyncFollowsEveryPageTestCrashThenRestartkills the broker atprepared, after the intent, afterack_received(write not sent), after the write, after the probe is journaled, betweencommit_targetandrelease, and before the result is delivered; each then restarts twice and checks the target's write count never exceeds one.Review fixes (25 Nov, Guide "Lost delivery", "Missing retry")
ErrBlocked, so the abort and its operation ID are never lost (DECISIONS 63).Account.Unreportedin the journal;Recover(every reconnect) re-sends it (DECISIONS 64).startTestUndeliveredAbortIsSentBeforeTheNextRunRecoverTestUndeliveredHealthIsResentOnRecoverReview fixes, round 2 (25 Nov: security review, Guide "Reservation recovery")
06c3cd3: addressed in3c4ca05and1144d0c(DECISIONS 72, 73).reserving(with the highest version seen so far) before the broker asks for a version. Recovery, the next rotation or the next scheduler tick (Broker-local rotation scheduler (§3.4, §4.4) #12) reserves again under the same operation ID, accepts that operation's own version even when sync has copied it into the high-water mark, and aborts it (restart_before_send) without writing, so the lock is released and rotation resumes. A refusal means nothing was reserved.sync_accountpages with the newfromcursor of Control Plane rotation storage and broker channel requests (§3.5, §4.3) #10 (9aa3f40).reservingrunTestACommittedReservationWithoutAPreparedRunIsSettledReserveTestReservedVersionMustBeAboveTheHighestSeensetHealthwithout the pending flagTestQuarantineHealthSurvivesACrashBeforeItsReportTestAccountSyncContinuesFromTheLastVersion(new)Round-2 checks (stack tip
ca19e6a): full suite-raceandGODEBUG=fips140=on, SQLite (k81, exit 0) and PostgreSQL 17 (k80, exit 0); Docker connector suites-raceon Major under kslot (26 tests, 0 skipped);go vetat every branch head,gofmt.Round 3 (25 Nov): the broker follows the account cursor
accounts_next, a sync page may list no accounts and still advance. The broker sends the cursor back asaccounts_afterand refuses a page that does not advance (1ada978).accounts_nextTestSyncFollowsTheAccountCursorChecks (stack tip
96c38fd): full suite-raceandGODEBUG=fips140=on, SQLite (k83, exit 0) and PostgreSQL 17 (see #16); Docker connector suites-raceon Major under kslot (30 tests, 0 skipped, exit 0);go vetand the broker, store and brokerproto tests at every merged branch head;gofmt.Round 4 (25 Nov):
mainmerged upmain(736e148) and the round-4 fixes on Broker listener, CA and pairing (§4.1) #8 (CodeQL), Control Plane rotation storage and broker channel requests (§3.5, §4.3) #10 (MaxEnvelope), Enrollment and re-enrollment (§3.4, §4.5) #15 and Checkout, possession proofs, leases, manual rotation (§3.4, §3.6) #16. There are no code changes of its own. The only conflict was additive, ininternal/store/store.go(Vault()next toMFA(); both kept, in Control Plane rotation storage and broker channel requests (§3.5, §4.3) #10).Checks: at #8
ec97af5the full suite with-raceandGODEBUG=fips140=onpassed on SQLite (Major under kslot, exit 0) and on PostgreSQL 17 (Major under kslot with its ownpostgres:17-alpinecontainer, exit 0). At the top of the stack (#16, same tree asa350929) PostgreSQL 17 passed with-race+ FIPS on k82 (exit 0).gofmtandgo vet(also-tags docker) are clean at every branch head. The mutation proofs ran on throwaway copies.Round 4b (25 Nov): Guide "Recovery retry" at
401d2a0servenow retries both with backoff (1 s, doubling to 1 min) until they succeed, and waits for the retry goroutine before it returns (781eacd). Previously the error was only logged until the next reconnect. The first attempt still runs before any push is handled.TestStartUpIsRetriedUntilItSucceeds(k82)Checks (round 4b): at #8
f212849and at #16bdb9adf, the full suite with-raceandGODEBUG=fips140=onpassed on SQLite (Major under kslot; every K host was busy) and on PostgreSQL 17 (Major under kslot, ownpostgres:17-alpinecontainer), all exit 0. #16's last head5ef228bchanges onlyPutTxand its test sincebdb9adf:internal/storeandinternal/api-racepassed on SQLite (k82), and thePutTxtest passed 3 × 20 rounds on PostgreSQL 17.gofmtandgo vet(also-tags docker) are clean at every branch head. The mutations ran on throwaway copies.Round 4c (25 Nov): Guide "Lost manifest" at
b694939Trustfrom the journal (c949950), so the next sync accepts and persists the manifest again. Before, the manifest stayed only in memory and disappeared on restart.TestFailedManifestAppendIsPersistedOnRetryChecks (round 4c): at #16
9fb8788, the full suite with-raceandGODEBUG=fips140=onpassed on SQLite (Major under kslot) and on PostgreSQL 17 (Major under kslot, ownpostgres:17-alpinecontainer), both exit 0.gofmtandgo vet(also-tags docker) are clean at every changed branch head. The race tests ran on PostgreSQL 17 in my own container; the mutations ran on throwaway copies.Round 5 (25 Nov): Guide "Lost retry" at
cac28d4Unreportedset, butRecoverstill returned nil, so the start-up retry stopped.Recovernow fails while any account's health is undelivered, and the retry runs again until the report lands (19cf59e).origin/main(to store: chained audit append on both drivers (§9.3) #19,eab8a43) is merged in.Unreportederror inRecoverTestRecoverFailsWhileHealthIsUndelivered(k83)Checks (round 5): at
251118d(main to #25),go vetand the full suite with-raceandGODEBUG=fips140=onpassed on SQLite (k80, exit 0) and on PostgreSQL 17 (k83, exit 0). Headd21a091only addsmain's #26 and #27. At16f758d(#26) andd21a091(#27),go vet ./...and-race+ FIPS on PostgreSQL 17 passed on the packages those PRs touch, plusinternal/brokerandcmd/...(k83, exit 0 each). CI runs the full suite on the head.gofmtis clean. The mutation ran on a throwaway copy.🤖 Generated with Claude Code