Plan: Passkey Signer Credentials for Browser-Signed Intake Reports (epic &101)
- Status
- Anchors
- Context
- Scope
- Design
- D1.
craig-webauthn(U1, #2192) - D2. Keyring schema and configuration (U2 #2193, U3 #2194)
- D3. Registration and self-service in the keyring (U4 #2195, U7 #2198)
- D4. Report signing in intake (U5 #2196)
- D5. Browser pages (U6 #2197, U8 #2199)
- D6. Admin and operator surface (U9 #2200, U10 #2201)
- D7. Tests (U1–U12) and close-out (U13 #2204)
- D1.
- Test matrix
- Verification
- Rollout + risks
- Review log
Status
In progress
Erratum (2026-10-07, U1): the CBOR crate is cbor4ii 1.2.3, chosen by the maintainer from the D1 comparison recorded on
#2192; craig-webauthn reads it through its own position-tracking dec::Read (the crate’s SliceReader hides its offset).
Erratum (2026-10-07, U1): a none-attestation registration is unsigned, so the test-matrix contract "fail on every one-byte
mutation" applies to the captured assertions. Registrations are checked for every truncation and for a changed key coordinate
breaking the assertion chain. Every Chromium registration carries AT + ED (default credProtect output after the COSE key).
Erratum (2026-10-07, U3): neither D2 devstack option was needed. Chromium’s virtual authenticator accepts RP ID
host.docker.internal over the self-signed TLS instance once certificate errors are ignored, so one keyring is configured
with that RP ID and the TLS origin, and the e2e container keeps reaching services as host.docker.internal (devstack.adoc).
Erratum (2026-10-21, U3 fix): the devstack keyring now uses the first D2 option: RP ID localhost and both SHINES origins
built from the instances' port variables, so the plain-http instance can offer passkeys too (devstack.adoc § Passkeys).
Erratum (2026-11-22, U7): the add_device assertion binds attestation_digest (SHA-256 of the new device’s
attestationObject) as well as new_kid. new_kid derives from the credential ID alone and a none attestation is
unsigned, so binding only new_kid let a party on the path swap the public key under the same kid. Found by the commit
review of #2198. U8’s page must compute the digest.
Erratum (2026-11-22, U6/U8/U11): U6 and U8 land in one MR with their browser spec (intake-passkey.spec.ts), since the
pages share passkey.js and cannot be exercised apart. The spec’s Chromium reaches the TLS instance as
https://localhost:8013 through a host-resolver rule. The refused-prompt case fails user verification instead of turning
presence simulation off. Add-device runs on one virtual authenticator: steering the create to a second one was tried twice
and timed out, cause not established. Device-bound mode is not exercised in the browser. #2202 keeps the last two.
Anchors
| Anchor | What binds here |
|---|---|
ADR-082 D1–D9 |
The decisions every unit implements. This plan adds file-level placement, unit boundaries and the test matrix; it does not re-decide anything. |
|
The keyring: |
|
|
|
The shared JWS checks, the cached by-kid client and the replay client the passkey path reuses. |
|
The SHINES-only |
|
|
|
The JWS test signer the software authenticator sits beside; the evil corpus the new header and register body join. |
Context
ADR-082 replaces the browser private-key file with a passkey while keeping detached JWS for SDK and machine clients. The goal is usability. The design is settled there; this plan sequences it. Verified facts the units build on:
-
deny.tomldeniesopenssl/openssl-sys;p256,ecdsaandsha2are workspace dependencies; no CBOR crate is inCargo.lock. -
RegisterSignerKeyRequest.key_idis capped atIDENTIFIER_MAX= 64 (craig-validation). -
The keyring’s register serializes fleet-wide on
pg_advisory_xact_lock(hashtext('craig_intake_keyring_register')); every lifecycle transition bumpskeyring_meta.revocation_generationin its own transaction. -
JwsReplayClient::checkalready carries an optional receipt and reads an optionalrevocation_generation. -
Standalone intake requires
client_id/client_secrettoday; the keyring ignores the bearer the clients mint. That is unchanged here.
Scope
Units are U0–U13, one per child issue of epic &101. U0 (#2191) is this plan page, its nav entry and its review.
In: ADR-082 D1–D9 as the units below, the canonical doc pages each unit’s surface touches, and their
CHANGELOG.adoc entries.
Out: a browser admin approve/revoke UI; the SHINES evidence mapping (#691); integrated-mode passkeys (craig-security / craig-web); attestation and authenticator allow-lists; algorithms other than ES256; ADR-081 dynamic forms.
Design
D1. craig-webauthn (U1, #2192)
A library crate in crates/craig-webauthn, no I/O, no async. Newtypes for every protocol value: CredentialId
(bytes), Kid (the derived wa_… string), RpId, Origin, Challenge (32 bytes). One thiserror enum,
WebAuthnError, with a variant per failed check (ChallengeMismatch, OriginNotAllowed, RpIdHashMismatch,
UserNotVerified, BackupEligibleRefused, UnsupportedKey, BadSignature, Malformed), so callers can trace the
cause and still return a uniform 401.
Public surface:
-
parse_authenticator_data(&[u8]) → Result<AuthenticatorData, _>: fixed 37-byte prefix, then the attested credential data only when the AT flag is set. Every slice access is checked; no indexing. -
parse_attestation_object(&[u8]) → Result<Registration, _>: CBOR map,fmtmust equalnone, COSE EC2 P-256 alg -7 converted to ap256::PublicKeyand its JWK. -
ClientData::verify(&self, CeremonyType, &Challenge, &[Origin]) → Result<(), _>: a typedserdestruct, neverserde_json::Value. -
verify_assertion(&PublicKey, authenticator_data, client_data_json, der_signature) → Result<(), _>. -
derive_kid(&CredentialId) → Kid. -
Policy { rp_id, origins, require_device_bound }withcheck_flags(&AuthenticatorData) → Result<(), _>(UP, UV, and BE when device-bound).
The CBOR crate is chosen first, inside U1, by the three-way comparison the judgment protocol requires. The candidate
set starts from ciborium (used upstream by passkey-types and passkey-auth; nothing in this tree depends on a CBOR
crate yet), minicbor, and coset (COSE-specific, on top of ciborium). The comparison goes to the maintainer
before the dependency is added. The approved pick is recorded in the U1 MR and as an erratum line on this plan.
D2. Keyring schema and configuration (U2 #2193, U3 #2194)
U2 adds one migration with the ADR-082 D1/D4 columns. signer_identities.id and every new primary key are UUIDv7.
CHECK constraints carry the per-kind shapes, and the existing rows backfill to jws. KeyRecord gains the new
fields; the JWS paths read them as None.
U3 adds WebAuthnSettings inside KeyringSettings (CRAIG_INTAKE_KEYRING__WEBAUTHN_*). It is validated at boot and
exposed as GET /webauthn/config. Intake gains a KeyringWebAuthnConfig fetched in boot_standalone_shines before
the router is built. A failure there is an anyhow boot error naming the URL. The fetched value becomes
craig_webauthn::Policy and rides the /signed/v1 nest as an extension.
Devstack’s two SHINES origins (localhost:8011 over HTTP, :8013 over TLS) cannot share one RP ID if the e2e host
is not localhost. U3 first confirms which host Playwright’s
Chromium virtual authenticator accepts as an RP ID against the TLS instance (ADR-082 open question 3). It then decides
between two options and documents the choice in devstack.adoc: an RP ID of localhost plus an origin list
carrying both ports; or a second keyring instance for the TLS intake. Browser units start only after this.
D3. Registration and self-service in the keyring (U4 #2195, U7 #2198)
The keyring’s register handler accepts two bodies. The shared contract type RegisterSignerKeyRequest
(craig-security-contracts) is not changed: a body without a kind field is today’s JWS registration, exactly as
machine clients and craig-security send it. A body with "kind": "webauthn" is the new RegisterPasskeyRequest, a
keyring-local type. Dispatch reads kind before deserializing; any other kind value is 400. The webauthn path
runs craig_webauthn against the configured Policy, then inserts the identity and the key in one transaction
under the existing register advisory lock. A duplicate credential_id maps to 409 through the unique constraint.
Self-service is one route, POST /self-service, with a kind-tagged op body. The keyring verifies the assertion
and inserts its jti into replay_records (the same upsert as the report path; a replay is 401). It then authorizes
the operation against the signing key’s identity and status:
| Operation | Pending signer | Approved signer |
|---|---|---|
view |
yes |
yes |
rename |
yes |
yes |
revoke self |
yes |
yes |
revoke sibling |
no (401) |
yes |
add_device |
no (401) |
yes |
A revoked or expired signing key gets the uniform 401 for every operation.
The add_device op body carries both ceremonies: the new device’s registration (attestation_object,
client_data_json, iat) and the approved sibling’s assertion. The registration challenge is computed from the
identity’s stored labels, not from labels in the request. The assertion’s challenge binds new_kid, which must
equal derive_kid of the credential ID in the new attestation; a mismatch is 400. The new key is inserted directly
into the signer’s identity. /keys/register is never used for a second device, since it always creates a new
identity.
add_device takes a per-identity transaction advisory lock (pg_advisory_xact_lock keyed on the identity id), then
counts the identity’s active keys and inserts the new key as approved or pending. Approval bumps the generation in the
same transaction. An out-of-group target is 404.
Intake proxies POST /signed/v1/passkeys to the keyring byte for byte, mirroring forward_register, with the same
error redaction.
D4. Report signing in intake (U5 #2196)
verify_signed_jws becomes verify_signed_credential. It dispatches on which header is present (both present is
401) and returns the same VerifiedSigner. The two branches share one tail: the iat window, the replay check and
recheck_on_generation_bump.
The passkey branch decodes X-WebAuthn-Assertion into a typed struct, recomputes the challenge from
hash_payload(canonical), and resolves derive_kid through SignerAuthClient::lookup. It then rejects a row whose
credential_kind is not webauthn and calls craig_webauthn::verify_assertion. The JWS branch gains the mirror
kind check.
SignerKeyInfo gains credential_kind: CredentialKind, defaulting to Jws when absent. JwsReplayClient::check’s
receipt argument becomes an enum (`Jws { … } | WebAuthn { … }), serialized as the existing three fields or as
webauthn_receipt.
U5 also owns the keyring side of the receipt. The replay-check handler accepts webauthn_receipt, and replay_check
appends a webauthn row to the U2 signing_receipts columns in the first-seen transaction. All-or-nothing applies per
shape, and a body carrying both shapes is 400 before any write.
D5. Browser pages (U6 #2197, U8 #2199)
craig-sign.js loses the key generation, export and signReport code, and a new passkey.js module takes over:
-
createPasskey(labels) -
assertForReport(canonicalHash, jti, iat) -
assertForOp(op) -
base64url helpers
-
a
PublicKeyCredentialfeature check
report-sign.js keeps its window.CRAIG_SIGN bridge but exposes only assertForReport, canonicalize and
sha256Hex. canonicalize keeps the cross-language parity vector. /passkeys is a new SHINES-only template and
Alpine factory; it lives in the same if keygen block in ui.rs, and its i18n keys join JS_I18N_KEYS.
D6. Admin and operator surface (U9 #2200, U10 #2201)
PUT /identities/{identity_id}/revoke reuses transition’s single-bump shape: one transaction updates every
non-revoked key in the group and bumps the generation once. The metadata list `GET /keys gains credential_kind,
identity_id and backup_eligible, and intake’s /signed/v1/keys proxy type gains the same fields.
verify-receipt is a second non-serving mode beside migrate in main.rs, run before settings load. It uses the
database URL alone, and its logic lives in a new receipt.rs so main stays a dispatcher. The exit-code mapping is
one enum VerifyOutcome converted to a std::process::ExitCode.
D7. Tests (U1–U12) and close-out (U13 #2204)
The test matrix below is the contract. U11 (#2202) owns the Playwright suite, which is also the test coverage for the browser units U6 and U8; U12 (#2203) owns the manual pass and the real-authenticator vectors. U13 accepts ADR-082 with as-built notes, fixes the keyring page’s stale 60s-cache claim, and archives this plan.
Test matrix
| Unit | Tests (category) | Where |
|---|---|---|
U1 |
proptest no-panic on |
|
U2 |
each CHECK rejects a mixed or missing shape; existing rows survive the migration (invariant) |
|
U3 |
each |
keyring |
U4 |
happy path; one test per verification rejection; device-bound; 409; 429 at |
|
U5 |
happy path (JSON + multipart); each rejection; both headers; cross-kind both ways; stale |
|
U7 |
every permission-table cell; cap boundary at the default 3; out-of-group 404; replayed op |
|
U9 |
identity revoke bumps once and evicts an intake cache entry; auth failures; list fields |
|
U10 |
valid JWS, valid WebAuthn, tampered payload, recycled |
keyring |
U6, U8 |
covered by U11’s specs (browser pages have no Rust surface) |
— |
U11 |
keygen → approve → sign → submit; pending 401 message; UV failure; prompt cancelled (presence simulation off,
which surfaces as the same |
|
U12 |
the manual checklist on four authenticator classes; their vectors join U1’s contract tests |
|
Every devstack-dependent Rust test carries #[ignore = "requires devstack"], as the existing keyring and intake suites
do. The software authenticator (U4) is a typed builder in craig-test-lib/src/passkey.rs, used like
generate_test_keypair.
Verification
-
Per unit: the pre-push battery (or CI under the no-verify convention), plus that unit’s tests above.
-
U5 onward: the existing JWS signed-submit,
jws_*and evil-corpus suites pass unchanged. Only U6 deletes tests, and only those of the removed key-file flow, named in its MR. -
Before U13: U12’s manual pass is green on all four classes and its versions are recorded.
-
cargo deny checkstays clean after U1, andcargo xtask plan-lintpasses on this page at every unit.
Rollout + risks
-
Order: U0, then U1–U3 in parallel; then U4 → U5 → U6/U7 → U8; U9 after U2; U10 after U5; then U11 → U12 → U13. Until U6 ships, the browser path stays on key files. Nothing user-facing changes before U6.
-
Risk: an authenticator emits a shape U1’s profile rejects (an unusual COSE encoding, a long credential ID). This surfaces at U12 at the latest; the response is a
fix:issue against U1, not a relaxed check. -
Risk: devstack cannot carry both origins under one RP ID (D2). U3 resolves it before any browser unit starts.
-
Risk: the CBOR crate comparison finds no fitting candidate. U1 then stops and returns to the maintainer; this plan does not pre-authorize hand-written CBOR parsing.
Review log
| Round | Vendor | Resolved model | Verdict |
|---|---|---|---|
1 |
Anthropic — a fresh subagent given only this plan, ADR-082 and |
Claude Opus 5.5 |
no-ship: four
Q2 blockers, all fixed in-plan. They covered U0 undefined, the |