Repository navigation
desk: provisioning keys — reusable enrollment keys, a machine's own enrollment, the offline sweep - #97
Merged
Conversation
…osite's entry A reusable, revocable key with a name prefix, an expiry, an optional cap on uses and an optional offline auto-revoke, whose code `smns-provision-v1.` an admin's browser builds around the key's secret and the org key; redeemed at the same unguarded path as a one-time token and turned into an ordinary pending enrollment, so DX7's lifecycle carries over; a machine's self-revoke (`DELETE /machine/enrollment`, `sminos hub leave`); the Registry's offline sweep through the revocation path. Milestones across MAWS (hub, web) and doperpowers (sminos CLI and the parity vectors); the devcloud boot's interface pinned, the step itself out of scope. Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
… key file (the owner's ruling) Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
The self-revoke and the offline sweep bind to the enrollment, not the name (a check before the first fence; the replacement of a reused name survives). Access's denial is an explicit outcome: the stand-in answers a token it no longer holds as production does (401, a page naming Cloudflare Access), and the CLI reads that and the Worker's not-enrolled as "rejected", distinct from an outage. `sminos hub check` (GET /machine/enrollment, nothing written) with four exits, and the boot's reboot rule on them. The security rationale corrected: stdin-only keeps the key out of disk artifacts, not out of a VM that holds project-owner ADC; the recovery path written. Buildability: the parity adapter, the proof's exit status, the web build before the local hub, the name-taken walk. The four forks settled as written. Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
… and a recheck; exit 4 is the boot's to retry The fix wave's re-review, two findings ruled by the orchestrator: a marked 401 is a rejection only 600 s past enrollment and when it holds on a recheck 90 s later (the Worker's not-enrolled stays one at once); hub check's exit 4 means undecided, which the boot asks again with backoff until 0, 1 or 3. Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
…sweep (provisioning keys M1) An admin makes a reusable, revocable provisioning key (POST/GET/DELETE /api/provisioning-keys): a name prefix, an expiry, an optional cap on uses and an optional offline auto-revoke; its secret is answered once and kept as a hash. Its secret is redeemed at /machine/enroll as a one-time token is, through the spec's checks in order (key-revoked, key-expired, prefix-mismatch, busy, a rotation of the key's own pending name, name-taken, key-exhausted), all in the Registry's one synchronous step with the reservation, so uses hold under a race; the enrollment row it makes is an ordinary pending one bound to the key (enrollments.key). A machine reads its own record (GET /machine/enrollment) and revokes itself (DELETE). Revocation is one private path with three callers (an admin, the machine, the offline sweep), the latter two bound to the enrollment they read, so a name revoked and enrolled anew between two of their steps is left be. The alarm revokes a key's machine offline past the key's offline time; refreshOnline schedules it when a machine goes offline. The protocol module gains the provisioning code (smns-provision-v1.) and decodeCode over both prefixes. The stand-in answers a service token it does not hold as production Access does (401, a page naming Cloudflare Access), and its code helpers (one-time and provisioning) move to local/helpers.ts, served by the local command and the suites. Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
…int, the offline retry enforced, one reservation - A redemption's mint sets the pending enrollment's alarm before calling Cloudflare's API (the enrollment already busy), so a Registry reset during the calls still leaves a wakeup that expires it; a key-made row had none until the mint's finally. - A failed offline revocation waits its minute per enrollment in sweepOffline itself, not only in the alarm's time, so a redemption's sweep inside the window no longer retries it at once. - The token path and the key path reserve the name through one synchronous helper (`reserve`), each inside its own transaction. Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
…#91's test, MAWS #88) The mixed-run case waited only for the pending list, then asserted the browser's presence frames at once; under load the frame may not have arrived. Wait for it the same way. The other cases #91 added assert on a POST's answer or wait on the exact frame (m.next), so they are unchanged. Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
The Machines dialog gains a Provisioning keys section under the machine list: every member sees each key's prefix, uses over cap, expiry and the machines enrolled through it (revoked keys last), and machine rows say 'via <label>'. An admin holding the org key creates a key from a form checked in the browser (prefixProblem, fixed expiry and offline-revoke choices), confirms it with one of the org key's methods, and sees its code once with the boot line; revoking confirms on a step naming the machines that stay. The confirm and code steps are generalized into CodeSteps.tsx, shared by the one-time enrollment and the key. The machines double serves the three key endpoints; e2e-hub proves the flow against the local hub, and its machine removal test now expects Access's 401, which M1's stand-in answers. Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
…r nothing (provisioning keys M2, review fix) ConfirmStep, shared by the one-time enrollment and the provisioning key, now knows whether the owner is still on it. Cancelled or closed while the org key opens, it asks the hub for nothing; once the hub has been asked (a made key cannot be unmade), Cancel is off and the step says the code is on its way; an answer after the dialog closed is drawn nowhere. The key's bytes are wiped on every path. Tests hold the key's opening and the hub's answer to prove each. Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
… meanwhile, exit 1 Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
… Date.now() in render (provisioning keys M2, lint fix) react-hooks/purity refused the call to Date.now() in KeyRow's render. The keys section now reads useDayClock(), the clock the stream's day labels and the project view already use, and passes it to each row; a test pins the expired and expires wordings. Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
…in; the e2e-hub failures predate the branch Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
… execution report Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…tever the machine reads after The sweep's retry of a failed offline revocation was keyed to the machine still reading offline and overdue: when the Machine object's answer was lost after it fenced the credential, a reconnect's in-flight lease report could mark the machine online (or reset its deadline), and the retry was dropped, leaving a fenced credential whose record and Access token stayed held and whose own GET /machine/enrollment still answered active. A revocation the sweep began is now kept as unfinished and tried again a minute on until it completes, whatever the machine's online state or offline deadline; the alarm is scheduled for that retry, and a bound retry of a name enrolled anew ends as "already gone". Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
…n at dispatch A sweep builds its candidate lists before awaiting the first. Meanwhile another sweep (a redemption's) may begin, fail or finish one of them, so each candidate's live entry is read again just before it is dispatched: one whose retry is not yet due, or which another sweep is revoking now, is skipped, as is a retry whose entry another sweep cleared on completion. Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The hub and web side of the desk's provisioning keys: a reusable, revocable credential that lets an automated VM (devcloud) enroll at the desk with no human step. It extends DX7's enrollment as a child of the desk composite.
docs/doperpowers/specs/2026-10-21-desk-provisioning-keys-design.md, covering M1, M2 and M4.docs/doperpowers/specs/2026-10-21-desk-provisioning-keys-report.md.What changes
Hub (M1,
ccbb539b0, fix0602580be)POST,GETandDELETE /api/provisioning-keys. An admin creates and revokes; a member lists. Each key carries:max_uses;offline_revoke_s.The secret is shown once and stored as a hash.
POST /machine/enrolltakes a key's secret astoken.key-revoked,key-expired,prefix-mismatch,busy, a same-key rotation,name-taken, thenkey-exhausted.usesis counted in the same synchronous step as the reservation, so it holds under a race.GET /machine/enrollmentreturns it.DELETE /machine/enrollmentis the machine's self-revoke.provisioning_keystable and theenrollments.keycolumn, throughCREATE TABLE IF NOT EXISTSandADDED_COLUMNS. The owner approved this.Cloudflare Access.POST /standin/provisioning-code.Web (M2,
be133c3a3, fixd6195c5ce, lint fix040a9a8a5)via <label>.Whole-branch panel fix wave
44a1909e4: a sweep revocation whose fence was placed but whose answer was lost is retried until it completes, whatever the machine reads after.f992aeb81: the sweep re-reads its retry record at dispatch, so overlapping sweeps keep the per-enrollment wait.f992aeb81fixes in its review of44a1909e4, and its re-review was clean.Other commits on this branch
c2c4344cc:session-plane.test.ts's "applies an open project's frames…" now waits for the presence frame before asserting it. Under load it could assert before the frame arrived.Validation Evidence
scripts/ci-gate.sh … --gates static,unit,e2e:desk-webon027c290a9: success. Static, unit and e2e:desk-web are all green: https://github.com/SSFSKIM/MAWS/actions/runs/39549579112.44a1909e4was success;ce0b8407a(the last code head): success, https://github.com/SSFSKIM/MAWS/actions/runs/39553101895; the final head36dbd056dadds only the spec and report (static: success, run 39554704822).9296313e7(run 39544247573) was green on unit and e2e:desk-web. Its static job failed onreact-hooks/purityinProvisioningKeys.tsx, which040a9a8a5fixed. That is the run above.pnpm --filter desk-hub local, with doperpowersd358c760's sminos. Items 1–8, 10 and 11 pass as written:uses: 2,via devcloud;leave, and admin-revoked and lost-200 credentials, learned through the stand-in's 401;Items 6 (the offline sweep) and 11 (the revoke-and-replace race between resolve and leave) are hub-suite tests, run focused: 6/6 and 1/1.
pnpm lint: clean.Unresolved Review Findings
apps/desk-hub/src/objects/registry.ts, the offline sweep'sunfinishedrecord, kept in memory). If the Registry restarts after the sweep has placed a machine's fence but lost the answer, and before the retry runs, the retry is forgotten. The machine then takes the ordinary path. The gap is bounded: the fence refuses new streams, so the machine's lease lapses and the sweep completes the revocation oneoffline_revoke_slater. A durable record would need a new storage key, and the orchestrator ruled it not worth asking the owner for, given how rarely a restart lands in that window.apps/desk-hub/src/objects/registry.ts,ADDED_COLUMNS.enrollments). No suite starts from a Registry stored before this change. The mechanism is the one earlier deployed columns used, and the orchestrator checks it at deploy.apps/desk-web/src/views/machines/ProvisioningKeys.tsx).useDayClockfromviews/conversation/StreamView.tsx. That is the codebase's existing in-render clock, reused rather than duplicated.expiredlabel follows the day clock (midnight and visibility), not the second. The hub refuses an expired key whatever the label says.apps/desk-web/src/views/machines/CodeSteps.tsx). Closing the whole dialog while the hub mints leaves an unused key at0 / ∞, where it can be revoked. This is by design, since a key the hub made can't be unmade from the browser, and a test pins it.Residue
apps/desk-web/e2e-hub/session-plane.spec.tsfails five cases on master. The cases are M1 grid latency at :119 (offline 3844 ms against the 2500 ms bound) and the four G2 session-view cases at :191, :319, :350 and :411. They fail the same way on origin/master82a0967ffand on this branch. The spec sits outside the gate. Candidates are desk-hub: a machine POST's answer names the frames it refused (MAWS #88) #91's change to POST answers and the machine side of doperpowers desk-web: build and test under the React Compiler, as the Electron app does #106. Evidence: logs/tmp/dsk-scripts/pe-e2e-master1.logand/tmp/dsk-scripts/pe-e2e-branch1.log.Sminos-Session: smns-erb-71#b4948247 (doperpowers on macbook)