Skip to content

ui-react: deleted and unknown passkeys are never signalled to the credential manager #2559

Open

Description

@schlessera

Context

When the owner deletes a passkey, the server only removes the row and revokes its sessions (app.delete("/auth/passkey/:id", packages/ui-server/src/middleware/passkeys.ts:608-619). The client only drops it from the list (onDelete, packages/ui-react/src/components/settings/passkey-tab.tsx:96-107). The credential manager on the phone keeps offering the deleted passkey, and every later attempt to use it fails.

The same happens at login. A credential the server does not know returns the same generic 401 { error: "Passkey verification failed" } as any other failure (fail, packages/ui-server/src/middleware/passkeys.ts:359-367). The client cannot tell "this passkey no longer exists here" apart from other failures.

The WebAuthn Signal API fixes both. Guide security/passkey-management:

  • "The application MUST invoke signalAllAcceptedCredentials() automatically when the management page loads".
  • "The application MUST invoke signalAllAcceptedCredentials() immediately within your delete credential click handler post-fetch."
  • "All userId and credential ID parameters passed to Signal API methods … MUST be Base64URL-encoded strings."

Guide security/passkey-authentication: call signalUnknownCredential() only when the server reports the credential as not found "and the user is unauthenticated". That guide uses HTTP 404. This project keeps the documented 401 (docs/http-api.md, login-verify row) and adds a machine-readable code instead.

Support: Chrome Android 132 and Samsung Internet 29 have the Signal API. Firefox Android does not.

To signal, the client needs two values it does not have today:

  • The RP ID. GET /auth/passkey/list deliberately returns rows for every RP (packages/ui-server/src/middleware/passkeys.ts:578-585). A signal must list only the current RP's credentials, or it hides valid ones. When WEBAUTHN_RP_ID is a parent domain, the RP ID also differs from location.hostname.
  • The WebAuthn user handle: WEBAUTHN_USER_ID encoded as UTF-8 (userId, packages/ui-server/src/middleware/passkeys.ts:89-91), sent as base64url.

The same gap causes a bug in the list. PasskeyList badges a row as foreign when credential.rpId !== location.hostname (packages/ui-react/src/components/settings/passkey-list.tsx:65). With a parent-domain WEBAUTHN_RP_ID, that badges every valid passkey.

Blocked by #2556

Scope

  • Server, list: GET /auth/passkey/list returns { credentials, rpId, userId }:
    • rpId is the RP ID the passkey ceremonies would use for this request. Use resolveRp when an Origin is present, otherwise the configured or derived read RP.
    • userId is the base64url of the WebAuthn user handle.
    • credentials is unchanged.
  • Server, login-verify: when the asserted credential ID has no row for the current RP, return the same 401 with an added code: "unknown_credential", but only after the response's challenge has been consumed as a live authentication challenge. A caller without a fresh challenge cannot use the code to probe which credential IDs exist. Every other 401 is unchanged and carries no code.
  • Client, Security tab: after a successful list load, and after a successful delete followed by a list refresh, call PublicKeyCredential.signalAllAcceptedCredentials({ rpId, userId, allAcceptedCredentialIds }). The IDs are those of rows whose rpId === response.rpId. Never signal from a failed or partial list.
  • Client, login: in both conditional and button flows, when verify fails with code === "unknown_credential", call PublicKeyCredential.signalUnknownCredential({ rpId: <rpId from the request options>, credentialId: <base64url id> }).
  • Client, badge: PasskeyList badges foreign rows by comparing credential.rpId with the list's rpId, not with location.hostname.
  • Feature-detect each Signal method. When a method is missing, skip the call silently. A rejected signal is logged at debug level and never shown to the user.
  • BrainApi.passkeyList return type gains rpId and userId. Update docs/http-api.md (list row and login-verify 401).

Out of scope

  • Changing the login-verify status from 401 to 404.
  • signalCurrentUserDetails. There is no account rename in this app.
  • Filtering the list response by RP. Foreign rows stay visible so stale credentials can be deleted.
  • Two deployments with separate databases sharing one RP ID and user handle. That setup is unsupported: each one's signal would hide the other's passkeys. Note it in the WEBAUTHN_USER_ID and WEBAUTHN_RP_ID descriptions (packages/ui-server/src/config/env.ts:466-478).

Acceptance criteria

  • Server tests in packages/ui-server/tests/passkeys.test.ts:
    • The list returns rpId and the base64url userId.
    • An unknown credential with a live challenge gets 401 { error, code: "unknown_credential" }.
    • An unknown credential without a live challenge, and a failed signature, get 401 with no code.
    • Each test fails before the change.
  • Real-Chrome runtime test (CDP virtual authenticator, with PublicKeyCredential.signalAllAcceptedCredentials and signalUnknownCredential wrapped by an init script that records calls and restores descriptors):
    • Opening the Security tab records one signalAllAcceptedCredentials call with only current-RP IDs.
    • Deleting a passkey records a call without the deleted ID.
    • Signing in with a virtual-authenticator credential whose row was deleted server-side records one signalUnknownCredential call with that credential's base64url ID.
  • Android/Firefox support: with both Signal methods deleted from PublicKeyCredential, the same flows complete with no error UI and no thrown exception. Proven in the runtime suite.
  • With a parent-domain RP ID fixture, current-RP rows are not badged foreign.
  • The PR records a mutation: signal with every row instead of current-RP rows, and watch the RP-filter assertion fail.

Verification

bun run test packages/ui-server/tests/passkeys.test.ts
bun run test packages/ui-react/tests/passkey-login-runtime.test.ts   # BRAIN_REQUIRE_CHROME=1
bun run test
bun run api-report
bun run typecheck
bun run lint

Contract impact

  • This touches the integration contract, so it needs the contract label, a CONTRACT: commit prefix, and the doc updated in the same commit. Additive: two new list fields, one optional 401 code, and the BrainApi.passkeyList return type. Update docs/http-api.md.
  • This changes a published package's behaviour, so it needs a changeset.

2026-10-22 triage at main aa8c8966b59f031f054f4876dbca84048b40ae4f: verified the all-RP list, current unknown-credential/challenge order, client delete and foreign-RP badge paths. Refreshed moved server pointers. The brief specifies scope, exclusions, offline/runtime proof and additive contract impact with no outstanding needs prerequisite, so add agent-ready alongside blocked. #2556 remains OPEN and is a real helper/lifecycle dependency; its p2 is at least this issue's p2. Native parent #2554 is retained. No Signal implementation or browser success is claimed.

Activity

  1. added
    type: feat
    area: ui-server
    area: ui-react
    priority: p2
    blocked
    contract
    on Oct 22, 2026
  2. added
    agent-ready
    on Oct 22, 2026
  3. schlessera commented on Oct 22, 2026

    @schlessera
    OwnerAuthor

    2026-10-22 triage at main aa8c8966b59f031f054f4876dbca84048b40ae4f: verified the all-RP list, current unknown-credential/challenge order, client delete and foreign-RP badge paths. Refreshed moved server pointers. The brief specifies scope, exclusions, offline/runtime proof and additive contract impact with no outstanding needs prerequisite, so add agent-ready alongside blocked. #2556 remains OPEN and is a real helper/lifecycle dependency; its p2 is at least this issue's p2. Native parent #2554 is retained. No Signal implementation or browser success is claimed.

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

    agent-readyarea: ui-reactarea: ui-serverblockedcontractpriority: p2type: feat

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions