Repository navigation
design: WebAuthn approval bound to the request (#37) - #38
Merged
Merged
Conversation
chaodu-agent
marked this pull request as ready for review
November 18, 2026 21:44
Address both REQUEST_CHANGES verdicts (opus, sol) on PR #38. - H1 credential store: one store lock (mutex + flock on approvers.lock) for every writer; generation counter; write-back skips absent ids; revocation linearization point defined (8.1, 4.2 step 0, 8.2) - H2 fail closed on reload: invalid or unreadable store is Unavailable with an empty set; full-file read per refresh (8.1, 10) - H3 no Basic downgrade: mode from config only; webauthn never approves with Basic; zero credentials refuse no_credential_enrolled (9, 8.5) - H4 /enroll/begin compare-and-spend under enrolment mutex; spent record kept for attempt lifetime; single monotonic deadline; cleanup (4.1) - M5 BE/BS sourced from authData; flags_invalid / flags_changed (4.1) - M6 enrolment refusal codes, wire collapse, 20/min cap (4.1, 12) - M7 credential_state_changed record for accepted BS changes (12) - M8 Q4 reconciled with muse-gated-passthrough 3.9 (12, 14 Q12) - L1 cred_fp widened to 16 hex; duplicate cred_fp/labels refused (8.1) - L2 synced passkey is one credential across Apple devices (2.3, 8.3) - L3 no approvers.json.bak (8.1) - L4 counter and store write failures specified (8.1, 10) Q1 to Q4 kept as decided.
Findings fixed (sol.md, muse-webauthn-review2): 1. Checks 8-10 (4.2): checks 8 and 9 compute proposed BS and counter only. Check 10 verifies the signature. Check 11 commits counter, BS, the staged credential_state_changed event and Approved inside one table critical section. Test T-A added (13 stage 2): an invalid signature leaves memory, disk and credential-state audit output unchanged. 2. credential_state_changed (8.1, 12, 4.2): the event is staged under the lock with a seq ordering value and written by one ordered emitter after release. No audit or file I/O under the table lock. The "nothing new is written inside the critical section" wording now covers non-event writes only. 3. Q4 (12, 14 Q12): the WebAuthn additions to per-approval records are exactly auth and cred_fp (plus the refusal code). Section 3.9 base fields of assertion_verified and assertion_refused are listed per record. The Q4 decision is kept. 4. Enrolment authentication (4.1, 6.2, 7.1): normative matrix. Basic is required on GET /enroll, /enroll/begin, /enroll/finish and /enroll/confirm, checked by the router before the handler. Token and attempt id stay the ceremony capabilities. The token-oracle paragraph no longer calls the endpoint unauthenticated. Stage 0 checks that the cached Basic credential reaches the same-origin fetch POSTs. 5. BS and counter merge (8.1, 4.2, 13): each stored credential has an immutable instance value written at confirm. Memory merges only for the same instance. An id new to memory, or with a changed instance, takes the file values. Write-back skips a changed instance. Test T-B added (13 stage 2): revoke and re-enrol the same id without a refresh. LOW text defects (opus.md): - Duplicated sentences removed in 4.2 (counter), 9 (notes) and 12 (approved). - Held-credential TTL: "at most 120 s from issue and never past the attempt deadline" in 4.1 checks 2 and 7. - BS merge rule: covered by finding 5. - /enroll Basic: covered by finding 4. - Audit failure wording: "already stored in memory" (8.1). Also: header revision note, section 6.2 cross-reference fixed to section 14 question 1, section 10 row for revoke and re-enrol, and section 17 response table. Checks run (document only, no test suite): - grep: "Nothing new is written inside", "written once per BS change", "one per attempt for 120 s", "use, 120 s", "Revision 2", "section 13, 1)" and the duplicate "approved (existing) gains" line are gone. - grep: "instance", "seq" and the T-A and T-B cases are present. - No trailing whitespace, no tabs, no consecutive duplicate lines. - Q1 to Q4 text unchanged in substance.
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.
Design note for #37 (documentation only, one new file:
docs/design/webauthn-approval.md).Draft, not final: it needs the standing council review before anything is decided. It describes draft PR #29 (stage 2, in review) as in review and depends only on its behaviour; section 11 lists the changes it would need from #29.
Covers: what to do today with Basic auth, threat model, enrolment and per-entry assertion protocol (derived challenge, verification inside the hold-table critical section), iOS Safari page flow, library comparison (webauthn-rs vs in-tree verifier vs nothing, with measured dependency and audit data), storage and revocation, mode matrix, failure analysis, audit allow-list, staged plan with negative tests, and open questions with recommended answers.
Refs #37.