Repository navigation
Broker-local rotation scheduler (§3.4, §4.4) - #12
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-12, 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 |
52fc62f to
4425d13
Compare
6a7e405 to
0f9b80e
Compare
4425d13 to
8e4bd31
Compare
0f9b80e to
f4ddc83
Compare
8e4bd31 to
fff702c
Compare
f4ddc83 to
1c391e8
Compare
fff702c to
6c5a94c
Compare
1c391e8 to
a9c8349
Compare
ea302d9 to
d901b32
Compare
75c24bf to
06c3cd3
Compare
d901b32 to
01699e1
Compare
The broker evaluates every account's Custodian-signed schedule by its own clock, every minute and when nudged, and runs only the latest outstanding occurrence: due in the past and after the floor max(last consumed due, policy persisted at, current envelope commit). Only release consumes an occurrence, so repeated ticks and nudges never run one twice, and a policy edit with a past anchor runs nothing due before it was accepted. A refused attempt waits until max(minimum-age deadline, now + interval); three in a row stop the account until a new policy epoch. A minimum password age above the interval runs nothing (schedule_below_min_age). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The scheduler's minimum-age fields now come from the connector at every pre-rotation login instead of only from tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
06c3cd3 to
1144d0c
Compare
01699e1 to
053d64f
Compare
|
Note 🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire Guide Unpopulated metadata fixed in |
Tick checks only the journaled minimum age, so the first pre-rotation login that reported an age above the schedule interval still sent the change, and a target that accepted it rotated. A scheduled occurrence now stops there: rotation_failed (schedule_below_min_age), aborted restart_before_send, nothing sent (§4.4). Manual and lease-cleanup rotations build their own context and are not affected. The two tests that relied on a refusal above the interval now use an age equal to the interval, and the read-at-login test covers the stop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Note 🤖 Claude Opus 5.5 responding on behalf of Yoshiofthewire Fixed in 5c2ef81. After
|
The scheduler goroutine outlived its connection. After a dropped channel, Run built a new Machine (with its own mutex) on the same journal while the old one could still be inside a rotation. The new Recover could then send a second probe, and the old copy could overwrite the new result, including a quarantine (§4.3 rules 5 and 6). serve now cancels its context and waits for every goroutine it started. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # internal/broker/broker_test.go
Tick only re-sent journaled enrollment receipts. An enrollment that stopped earlier (the Control Plane had accepted it, then a journal save failed) stayed open with no receipts. It blocked rotation and held the Control Plane lock until the next reconnect. Tick now resumes any open enrollment through recoverEnrollment, as a restart does: no second bind. serve also starts enrollments through its WaitGroup, so none outlives the connection (security review of #12). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # docs/DECISIONS.md
… mutex A Sync between selection and Rotate could accept a policy that stops the schedule and the queued rotation still ran (security review of #12). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
addressed in 5425b6e |
Only a reserving run was settled, so a scheduled run stopped by a failed Control Plane call on an open channel stayed open until a reconnect (PR Reviewer Guide "Stalled rotations" on #12). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Guide "Stalled rotations": fixed in 45399e7. |
In one line: Brokers now run rotation schedules themselves, by their own clock, with no Control Plane trigger: only the latest due occurrence runs, never twice, and refusals back off per the minimum-age rules.
What changed
Machine.Tickevaluates each account's Custodian-signedrotation_schedule;Scheduleticks every minute and on nudges (§3.4). Nudges carry no content and cannot cause anything a tick would not.max(last consumed due, policy persisted at, current commit); only the latest outstanding occurrence runs; onlyreleaseconsumes it.next_attempt_at = max(min-age deadline, now + interval); three refusals stop the account until a new policy epoch (§4.4). A minimum age above the interval runs nothing and reportsrotation_failed/schedule_below_min_age.Review this
internal/broker/schedule.gofloor/Outstanding: an off-by-one here runs an occurrence before the floor or twice.Checked: full suite
-race+GODEBUG=fips140=on, SQLite (k82) and PostgreSQL 17 (k83), exit 0; 8 mutations each failing its test (Detail). Not checked: reviewers and CodeQL (pending).Decided for you (
docs/DECISIONS.md46–47): skipped occurrences are implicit (the released occurrence's due time becomes the floor); the refusal counter is per account and resets onreleaseand on a new policy epoch, whilenext_attempt_atand the min-age deadline carry across epochs.You need to: nothing.
manual_rotation(which also resets the counter) arrives with the transaction PR.§13 checklist: Phase 1A "Broker-local scheduler, outstanding-occurrence rule, attempts, nudges, dedup"; acceptance 2 (no nudge), 8 (repeated nudges, past
anchor_utc), 9 (retry timing, three-refusal stop, min age above interval) with a fake target. Stacked on #11.Detail
floorTestOutstanding,TestSchedulerRunsDueOccurrencesOnceLastConsumedDueTestSchedulerRunsDueOccurrencesOnceBeforeinstead of!AfterTestOutstandingnext_attempt_atTestRefusedAttemptsRetryThenStopTestMinimumAgeAboveTheIntervalRunsNothingTestRefusalWaitsForTheMinimumAgeReview fixes (25 Nov: Guide "Unpopulated metadata")
MinAgeSecondsandMinAgeDeadlinenow come from the target: the connector'sAgeReporter(moved down from Active Directory LDAPS connector, tested against Samba AD (§4.4) #13) is read at every pre-rotation login, so a minimum age above the interval stops the schedule (schedule_below_min_age) and a refusal waits for the target's deadline, with no field set by hand (DECISIONS 74). Enrollment (Enrollment and re-enrollment (§3.4, §4.5) #15) still reads it too.reservingby a lost reply on its next tick (the Broker journal and rotation state machine (§4.2, §4.3, §4.6) #11 fix), and health changes here go throughsetHealth.TestTheTargetsMinimumAgeIsReadAtLogin,TestRefusalWaitsForTheMinimumAgeTestTickSettlesALostReservationRound-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.Review fixes, round 3 (25 Nov, Guide "Minimum-age enforcement")
rotation_failed(schedule_below_min_age), runaborted(restart_before_send), nothing sent (§4.4). The flag is set only byRotate, so manual and lease-cleanup rotations (Checkout, possession proofs, leases, manual rotation (§3.4, §3.6) #16) keep their own retry rules (5c2ef81).TestTheTargetsMinimumAgeIsReadAtLoginnow covers this. The target would accept the change, because its last change is 30 days old.TestRefusalWaitsForTheMinimumAgeuses a minimum age equal to the interval, which still runs. For a scheduled occurrence, the minimum age (at most the interval) plus the last change can never pass now + interval. So the deadline term inrefusedonly matters for lease cleanup, where the floor is 1 h.TestTheTargetsMinimumAgeIsReadAtLogin(the change was written)Rotatedoes not mark its context scheduledRound-3 checks (stack tip
a805e71): full suite-raceandGODEBUG=fips140=on, SQLite (k83, exit 0) and PostgreSQL 17 (k83, exit 0); Docker connector suites-raceon Major under kslot (30 tests, 0 skipped, exit 0);go vetand the broker/store tests at every merged branch head;gofmt.Review fixes, round 3b (25 Nov, security review at
d7a9315)42a173b.servenow cancels its context and waits for every goroutine it started before it returns, so a reconnect never runs a secondMachineon the journal beside a rotation that is still in flight. Enrollment and re-enrollment (§3.4, §4.5) #15 and Checkout, possession proofs, leases, manual rotation (§3.4, §3.6) #16 start their enrollment and transaction goroutines through the sameWaitGroup.Journal.Identity). It is fixed there and merged up.defer cancel()without waitingTestReconnectWaitsForTheRotationInFlight("the daemon reconnected while its rotation was still running")Checks (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)
CreateCAretry), Control Plane rotation storage and broker channel requests (§3.5, §4.3) #10 (chain room for standing wraps), Broker journal and rotation state machine (§4.2, §4.3, §4.6) #11 (start-up retry), Enrollment and re-enrollment (§3.4, §4.5) #15 and Checkout, possession proofs, leases, manual rotation (§3.4, §3.6) #16. The DECISIONS conflicts were additive, and both sides were kept.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)
store/vault_test.go), and both sides were kept.Checks (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): security review at
f9073a35425b6e:Ticknow selects and starts each account's occurrence in one hold of the machine's mutex (tick), so the policy, schedule, floor and refusal checks always see what a concurrentSyncaccepted. Higher up the stack (Checkout, possession proofs, leases, manual rotation (§3.4, §3.6) #16) the lease cleanup takes the same path.mainto store: chained audit append on both drivers (§9.3) #19).Tick(select under the lock,Rotateafter it)TestTickRechecksAPolicyAcceptedMeanwhileChecks (round 5): the full suite ran at the bottom (#11) and top (#16) of the stack (see #16). The broker package passed at this head. The mutation ran on a throwaway copy.
Round 5b (26 Nov): Guide "Stalled rotations" at
1b4cf38tickused to settle only areservingrun. Now any open run is finished as after a restart (45399e7).Rotateholds the mutex throughout, so a runticksees open has stopped, not one in progress, and recovery never writes twice. A scheduled run stopped by a failed Control Plane call on an open channel no longer waits for a reconnect.reservingrunsTestTickFinishesAStoppedRun🤖 Generated with Claude Code