Skip to content

Epic: passkey sign-in uses the browser's WebAuthn APIs and stays in step with Android credential managers #2554

Open
2 of 9 issues completed

Description

@schlessera

Outcome

Passkey sign-in and passkey management in @schlessera/brain-ui-react call the browser's WebAuthn APIs directly, keep Android credential managers (Google Password Manager, Samsung Pass, third-party providers) in step with the server's credential list, and leave the password form something those managers can save and fill. A passkey-only deployment's login screen makes no WebAuthn request it cannot complete. Browsers that lack a newer API keep working: they lose that one enhancement and nothing else.

Why now

A review of the UI/PWA against Google Chrome's public modern-web-guidance skill (guides security/passkeys, security/passkey-*, security/quick-sign-ins, forms/autofill-sign-in-form, security/security §1.3) found these problems:

  • Before ui-react: a passkey-only login screen starts conditional UI with no autofill field and burns the options rate limit #2555, a passkey-only deployment's login screen started a conditional-UI request on every load that was certain to fail. Each attempt consumed a token from the unauthenticated options budget.
  • The client uses a library wrapper the guidance tells you not to use. The wrapper hides abort and re-arm behaviour.
  • When a passkey is deleted on the server, credential managers are never told, so the stale passkey keeps appearing.
  • Android password managers cannot save the password form.
  • Sensitive owner actions have no step-up check.

This epic covers those findings and a few smaller improvements. Nothing in it is a security incident.

Shared context

Browser-support policy (binding for every task here). Chrome for Android stable (installed WebAPK) and Samsung Internet current (v30 = Chromium 143, per MDN browser-compat-data) keep full function. Firefox for Android degrades gracefully. Anything not in both Chromium targets gets feature detection and a named fallback. Do not add polyfill dependencies. The modern-web-guidance guides say "Always install 'webauthn-polyfills'". This project overrides that. The host app (outside this repo) owns index.html, the manifest and the service worker.

API support (MDN browser-compat-data 8.1.6; Chrome Android / Samsung Internet / Firefox Android):

API Chrome A. Samsung Firefox A.
PublicKeyCredential.parseRequestOptionsFromJSON / parseCreationOptionsFromJSON / toJSON() 129 28.0 119
PublicKeyCredential.getClientCapabilities() 133 29.0 135
isConditionalMediationAvailable() 108 21.0 119
signalAllAcceptedCredentials / signalUnknownCredential 132 29.0 no

Where the code is:

  • Client ceremony wrappers: packages/ui-react/src/lib/passkeys.ts:1-58 (wrap @simplewebauthn/browser, dependency at packages/ui-react/package.json:56).
  • Login container: (LoginScreen, packages/ui-react/src/components/connectivity/login-screen.tsx:24-167). Login surface: (LoginForm, packages/ui-react/src/components/connectivity/login-form.tsx:40-127).
  • Security tab: (PasskeyTab, packages/ui-react/src/components/settings/passkey-tab.tsx:23-194) and (PasskeyList, packages/ui-react/src/components/settings/passkey-list.tsx:42-112).
  • Server routes: (passkeyPublicRoutes, packages/ui-server/src/middleware/passkeys.ts:301-450) and (passkeyManagementRoutes, packages/ui-server/src/middleware/passkeys.ts:457-595). RP resolution: (resolveRp, packages/ui-server/src/middleware/passkeys.ts:180-202). Session cookie: (issueSessionCookie, packages/ui-server/src/middleware/auth.ts:309-336).
  • Client API methods: packages/ui-react/src/lib/api-client.ts:760-800. The BrainApi signatures appear in api-report/ui-react.txt and are part of the package API.
  • The server keeps @simplewebauthn/server (packages/ui-server/package.json:67). The guidance recommends SimpleWebAuthn for the server side only.

Where the contract is: docs/http-api.md (part of the contract through docs/integration-contract/http.md) documents every /api/auth/* route, the brain_ui_session cookie name and the login-verify 401. PasskeySummary (packages/ui-sdk/src/protocol.ts:1950-1961) and BrainApi are package API. Any change to these follows docs/integration-contract.md.

Binding decision records:

Runtime proof: the ui-react *-runtime.test.ts suites drive real Chrome through Playwright, for example packages/ui-react/tests/auth-expiry-runtime.test.ts. Chrome DevTools Protocol's WebAuthn.addVirtualAuthenticator gives a keyless, deterministic passkey. Set BRAIN_REQUIRE_CHROME=1 so a missing Chrome fails the run instead of being skipped.

Constraints and non-goals

  • Out of scope: a related weakness in how password login is re-enabled when WEBAUTHN_RP_ID is unset. It is tracked privately as a security advisory. Do not discuss or fix it in these issues or their PRs.
  • No client-side WebAuthn library and no polyfill dependency. A small internal base64url codec is allowed as a fallback.
  • @simplewebauthn/server stays.
  • Status codes on existing routes do not change unless a maintainer rules otherwise (the needs: decision task). New fields are additive contract changes.
  • One owner, one WebAuthn user handle (userId, packages/ui-server/src/middleware/passkeys.ts:89-91). No multi-user work.
  • The password stays the bootstrap and break-glass credential. Nothing here registers a passkey without an explicit user action, because the first passkey for an RP disables password login (passwordLoginDisabled, packages/ui-server/src/middleware/passkeys.ts:289-295).
  • brain.db is not involved. Credential and principal state is in brain-ui.db.

Breakdown

In landing order:

  1. ui-react: a passkey-only login screen starts conditional UI with no autofill field and burns the options rate limit #2555: delivered through fix(ui-react): start passkey autofill only beside a password field (#2555) #4183 (215887542). Conditional UI requires the password surface (if (!methods.password), packages/ui-react/src/components/connectivity/login-screen.tsx:93-105). The explicit passkey button remains available.
  2. ui-react: passkey ceremonies use native WebAuthn JSON APIs with an owned abort signal instead of @simplewebauthn/browser #2556: replace @simplewebauthn/browser with native WebAuthn JSON APIs. This adds an owned abort, re-arms conditional UI after a cancel, and gates on capabilities.
  3. ui-react: the password sign-in form cannot be saved or filled by Android password managers #2557: make the password form saveable and fillable by password managers.
  4. ui-react: deleted and unknown passkeys are never signalled to the credential manager #2559: tell credential managers about deleted and unknown passkeys through the Signal API.
  5. ui-server: passkey and principal management need a fresh passkey verification, not just a 30-day cookie #2560: require a fresh passkey verification before passkey and principal management. All five security policies and the three interview choices are settled; the maintainer accepted the complete rev 2 shared-prompt specification (S1–S9) in the final design ruling. Its complete brief is ready but still blocked on ui-react: passkey ceremonies use native WebAuthn JSON APIs with an owned abort signal instead of @simplewebauthn/browser #2556; approval does not establish implementation or browser proof.
  6. ui-react: the passkey list shows the provider name from the stored AAGUID #2561: name each passkey's provider from its AAGUID.
  7. ui-server: the browser session cookie is named __Host-brain_ui_session #2562: rename the emitted browser session cookie to __Host-brain_ui_session, retain legacy input, and apply the maintainer’s recorded breaking classification.
  8. ui-react: offer an explicit platform passkey after a password sign-in #2563: the accepted design is a once-per-cold-password-sign-in card in Chat after boot, with 90-day device dismissal, no warm re-auth offer and truthful password-policy copy. Ready brief; still blocked on ui-react: passkey ceremonies use native WebAuthn JSON APIs with an owned abort signal instead of @simplewebauthn/browser #2556.
  9. ui-server: serve /.well-known/webauthn so one passkey works across an instance's related origins #2564: related-origin requests are closed as a documented no under the 2026-11-10 maintainer ruling. Per-host passkeys remain supported; reopen only on a concrete workflow requiring shared passkeys across unrelated hostnames. No related-origin implementation is required by this epic’s current branch.

Definition of done

  • Every listed task is closed, or closed as a documented "no" where its issue allows that.
  • packages/ui-react/package.json no longer depends on @simplewebauthn/browser, and api-report/ui-react.txt no longer references it.
  • One real-Chrome runtime test with a virtual authenticator covers all of these: password-plus-passkey login, passkey-only login, a cancelled button ceremony that re-arms autofill, and a delete that calls signalAllAcceptedCredentials.
  • docs/http-api.md matches every changed auth route, field and cookie.

2026-10-22 triage at main aa8c8966b59f031f054f4876dbca84048b40ae4f: verified the named public/management RP and password-policy declarations and refreshed their moved source ranges. Child #2560 now has all five policy rulings recorded and retains needs: design for its client prompt under the final policy ruling; supplied design proposals on #2563 are inputs awaiting acceptance, not implementation approval. Preserve the native child breakdown, current priorities and absence of epic readiness. No browser capability or completed sign-in proof is inferred.

2026-10-22 later-ruling reconciliation: #2562 now has its emitted-cookie breaking ruling; #2563 has an accepted post-boot Chat card design under comment6338299255, superseding the interstitial proposal. #2560’s policy remains settled, while its new prompt proposal (comment6338354442) awaits the remaining interaction/copy decisions. These are brief-readiness updates, not implemented sign-in or browser qualification. Preserve native children and no epic readiness.

2026-10-22 final-prompt reconciliation: the later #2560 rev 2 acceptance supersedes the dated pending-design/interaction statements above. Explicit-start, confirmation-before-verification, recovery-setting copy and all supplied placement/focus/cancellation/error/retry/caller requirements are approved. The child now carries agent-ready plus blocked on #2556, with no unresolved design/decision label. No security policy is reopened and no shipped passkey or runtime outcome is inferred.

2026-10-24 continued triage at main dc5d3c73282c29a3f0098306d398743ee18ec791: Verified and refreshed the PasskeySummary declaration range. Accepted child policies/designs, explicit exclusions, native parent and full browser/credential-manager proof remain unchanged; no sign-in, cookie, account or runtime action was performed.

2026-10-25 triage at main 827861e1fa71cd4a26b52f1ef0f96b849381acdf: Verified moved current-source anchors and refreshed navigation; historical receipts and unresolved prerequisites retain their identities. No new runtime proof is claimed.

2026-10-26 triage at main e69ade40513eea1e1aacf636a8da27bb9bd647a1: Inspected the named source anchors after the authentication and Activity write-worker changes and refreshed the current navigation pointers. Existing rulings, scope, prerequisites and native child relationships are preserved; this citation repair supplies no new runtime qualification.

2026-10-26 triage at main 2f10e0407769b685083c17a1c90bb43a060b94a0: Verified the moved current-source anchors after the writer and shell-startup changes and refreshed navigation. Historical receipts retain their source identities; scope, rulings and unresolved prerequisites are unchanged. No new runtime qualification is inferred.

2026-11-02 triage at main a84d9bfbcb4e608b504aa0a9feb1144ad9a0b77e: Reverified the named auth/client owners and corrected the moved PasskeySummary declaration. Accepted child policies and native membership remain unchanged; no sign-in, browser or credential-manager proof is supplied. Keep the epic outside agent-ready.

2026-11-11 triage at main 3c44ac6fc56d27675dadaf38a16254db53c39f69: Folded #2564’s explicit documented-no closure into the breakdown. Eight native implementation tasks remain open; no related-origin capability is implied.

2026-11-15 triage at main 3f8ff29341fbe25665cea42659f92e6f3d3ccef0: Corrected current-source navigation by inspecting the named declaration or guard. Existing decisions, historical receipts and remaining prerequisites are unchanged; no new runtime qualification is claimed.

2026-11-20 triage — Reconciled the delivered password-field gate with main bd751d434.

Sub-issues

Sub-issues

2 of 9 Issues completed
Loading 9 sub-issues

Activity

  1. added
    type: feat
    area: ui-server
    area: ui-react
    area: ui-kit
    priority: p1
    epic
    security
    on Oct 22, 2026
  2. schlessera commented on Oct 22, 2026

    @schlessera
    OwnerAuthor

    2026-10-22 triage at main aa8c8966b59f031f054f4876dbca84048b40ae4f: verified the named public/management RP and password-policy declarations and refreshed their moved source ranges. Child #2560 now has all five policy rulings recorded and retains needs: design for its client prompt under the final policy ruling; supplied design proposals on #2563 are inputs awaiting acceptance, not implementation approval. Preserve the native child breakdown, current priorities and absence of epic readiness. No browser capability or completed sign-in proof is inferred.

  3. schlessera commented on Oct 22, 2026

    @schlessera
    OwnerAuthor

    2026-10-22 later-ruling reconciliation: updated the native breakdown for #2562’s breaking cookie ruling and #2563’s accepted post-boot Chat card. #2563 still waits on #2556. #2560 now has a concrete shared-prompt proposal under needs: decision; its five security policies are not reopened. Earlier pending-interstitial wording is superseded. No child delivery or epic readiness is claimed.

  4. schlessera commented on Oct 22, 2026

    @schlessera
    OwnerAuthor

    2026-10-22 triage: folded #2560's later complete rev 2 acceptance into the native breakdown. The former remaining interaction/copy ruling is settled; the scoped child is ready but still blocked on #2556. Its accepted UI/runtime criteria remain required implementation proof. Preserved the parent epic, all other children, existing policy boundaries and no epic readiness.

  5. schlessera commented on Oct 24, 2026

    @schlessera
    OwnerAuthor

    2026-10-24 triage at main dc5d3c73282c29a3f0098306d398743ee18ec791: Verified and refreshed the PasskeySummary declaration range. Accepted child policies/designs, explicit exclusions, native parent and full browser/credential-manager proof remain unchanged; no sign-in, cookie, account or runtime action was performed.

  6. schlessera commented on Oct 25, 2026

    @schlessera
    OwnerAuthor

    2026-10-25 triage at main 827861e1fa71cd4a26b52f1ef0f96b849381acdf: Verified moved current-source anchors and refreshed navigation; historical receipts and unresolved prerequisites retain their identities. No new runtime proof is claimed.

  7. schlessera commented on Nov 10, 2026

    @schlessera
    OwnerAuthor

    2026-11-10 triage at main 3aadc8df5: citation drift only. api-client.ts:711-750 → 760-800 (the authMethods…passkeyDelete client methods) and PasskeySummary protocol.ts:1845-1855 → 1918-1928. All nine native children remain open; no merged PR since the 2026-11-02 pass closes or references one. Scope, approved breaks, labels and native membership unchanged; the epic stays outside agent-ready.

  8. schlessera commented on Nov 11, 2026

    @schlessera
    OwnerAuthor

    2026-11-11 triage: Folded #2564’s explicit documented-no closure into the breakdown. Eight native implementation tasks remain open; no related-origin capability is implied.

  9. schlessera commented on Nov 20, 2026

    @schlessera
    OwnerAuthor

    Epic state — 2026-11-20. #2555 is closed through #4183. The next scoped work is #2556, followed by the remaining passkey and password refinements in the breakdown. The combined real-Chrome proof remains part of the epic definition of done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: ui-kitarea: ui-reactarea: ui-serverepicpriority: p1securitytype: feat

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions