Repository navigation
fix(ui-react): start passkey autofill only beside a password field (#2555) - #4183
Conversation
…2555) Conditional UI attaches to the password input's `webauthn` autocomplete token, and a passkey-only login screen renders no password input. The screen still started the ceremony on every load: it spent a token of the host's login-options budget (10 per IP per minute), left an unused challenge, and logged a [passkeys] warning when @simplewebauthn found no input. The ceremony now starts only when the methods report a password. The explicit passkey button is unchanged. A render test counts login-options requests on both screens. A real Chrome runtime test with a CDP virtual authenticator proves the passkey-only screen asks for none and its button signs in, and that conditional mediation still starts once beside the password field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No uploads on this PR yet This PR changes UI files (
Tips for agentsLabel each shot so reviewers know what they're seeing. Labels apply to every file in a call, so run one uploads put after.png --pr 4183 --meta path=/settings --state after --caption "Saved settings toast"
uploads put chat.png --pr 4183 --app ios --screen "Chat" --state afterNo CLI? With the Uploads MCP, call This comment updates with each upload, so you don't need to post the images yourself. A shot or two in the PR description is still welcome. Check what's attached with Workspace admins can turn this comment off in Settings → GitHub · docs |
Independent reviewReviewed head f6e90cf against base 94f5580. Reviewer: agent. 3 findings: 0 fixed, 0 filed, 0 rejected, 3 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4183,
"head": "f6e90cfc641d20656ffbc2926d7b7666ba6520a0",
"base": "94f55806c3fe2686c5e026d368fbe0683fac265a",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-react/tests/passkey-login-runtime.test.ts:72 calls runtimePackageBuild(repo, [\"ui-react\",\"ui-server\",\"core\"], hook), but \"passkey-login\" is missing from runtimeTestBuilds in scripts/runtime-test-builds.ts:5-7. tests/runtime-build-selection.test.ts:12-13 asserts exactly 24 runtimePackageBuild( callers equal to Object.keys(runtimeBuildInventory); there are now 25, so that repo test fails and the build-selection wrapper never pre-builds for this file."
},
{
"summary": "PR #4183 has an empty description and no receipt comments, so criterion 5 (record a mutation: remove the `if (!methods.password) return;` gate at packages/ui-react/src/components/connectivity/login-screen.tsx:93, watch the passkey-only case fail on the request-count assertion, restore) and criterion 4's failing-first result (count 1 before the change, 0 after) are unmet."
},
{
"summary": "packages/ui-react/tests/passkey-login-runtime.test.ts:157-172 is titled 'offers the passkey in the field's autofill' (criterion 2), but it opens a new context whose fresh CDP virtual authenticator (line 109) holds no credential; the passkey registered in the first test lived on the closed first context's authenticator. It only asserts that mediation 'conditional' was requested, never that a passkey was offered, so that half of criterion 2 is unproven."
}
]
} |
…runtime test (#2555) The passkey registered in the first runtime case now moves to the second case's virtual authenticator, taken after the button sign-in so its signature counter is current. The field's conditional request then signs the app in through autofill with no button pressed, instead of only showing that a conditional request was made. Probes and mediations are recorded through an exposed binding, because that sign-in reloads the page. The new runtime file is listed in the runtime build inventory, and the inventory test's count is raised to 25. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Independent reviewReviewed head f6e90cf against base 94f5580. Reviewer: agent. 3 findings: 2 fixed, 0 filed, 1 rejected, 0 without a disposition. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4183,
"head": "f6e90cfc641d20656ffbc2926d7b7666ba6520a0",
"base": "94f55806c3fe2686c5e026d368fbe0683fac265a",
"reviewer": "agent",
"outcome": "findings",
"findings": [
{
"summary": "packages/ui-react/tests/passkey-login-runtime.test.ts:72 calls runtimePackageBuild(repo, [\"ui-react\",\"ui-server\",\"core\"], hook), but \"passkey-login\" is missing from runtimeTestBuilds in scripts/runtime-test-builds.ts:5-7. tests/runtime-build-selection.test.ts:12-13 asserts exactly 24 runtimePackageBuild( callers equal to Object.keys(runtimeBuildInventory); there are now 25, so that repo test fails and the build-selection wrapper never pre-builds for this file.",
"disposition": "fixed",
"commit": "3623d7e30c56fa99023e9f8482bf6643171bec52"
},
{
"summary": "PR #4183 has an empty description and no receipt comments, so criterion 5 (record a mutation: remove the `if (!methods.password) return;` gate at packages/ui-react/src/components/connectivity/login-screen.tsx:93, watch the passkey-only case fail on the request-count assertion, restore) and criterion 4's failing-first result (count 1 before the change, 0 after) are unmet.",
"disposition": "rejected",
"reason": "The PR body was empty because a body-writing script truncated its source file; the code was not missing proof. The body now records the failing-first result (Expected length 0, Received 1) and the gate mutation failing on PASSKEY_ONLY_NO_LOGIN_OPTIONS (- [] / + [\"POST\"])."
},
{
"summary": "packages/ui-react/tests/passkey-login-runtime.test.ts:157-172 is titled 'offers the passkey in the field's autofill' (criterion 2), but it opens a new context whose fresh CDP virtual authenticator (line 109) holds no credential; the passkey registered in the first test lived on the closed first context's authenticator. It only asserts that mediation 'conditional' was requested, never that a passkey was offered, so that half of criterion 2 is unproven.",
"disposition": "fixed",
"commit": "3623d7e30c56fa99023e9f8482bf6643171bec52"
}
]
} |
Independent reviewReviewed head 3623d7e against base 94f5580. Reviewer: agent. No findings. {
"version": 1,
"kind": "brain-review-receipt",
"pr": 4183,
"head": "3623d7e30c56fa99023e9f8482bf6643171bec52",
"base": "94f55806c3fe2686c5e026d368fbe0683fac265a",
"reviewer": "agent",
"outcome": "no-findings",
"findings": []
} |
Closes #2555.
What this does
Conditional UI offers passkeys in the password field's autofill. It needs an input whose
autocompleteends inwebauthn, and the login form renders that input only beside a password. A passkey-only login screen (/auth/methods→{ password: false, passkey: true }) still started the ceremony on every load. Each load:[passkeys] conditional UI failed, because@simplewebauthn/browserfound nowebauthninput.LoginScreen(packages/ui-react/src/components/connectivity/login-screen.tsx) now returns before the autofill probe, and so beforeapi.passkeyLoginOptions(), when the methods report no password. The explicit passkey button (onPasskeyClick) is unchanged, and so is everything #2556 builds on.Acceptance criteria
POST /api/auth/passkey/login-optionson load, no[passkeys]warningpasskey-login-runtime.test.ts"a passkey-only screen asks for no login options…" (real Chrome, real ui-server routes)mediation: "conditional"request, usernameless (allowCredentialsempty) for RPlocalhost. The registered passkey answers it, and the app signs in with no button pressed, after exactly one login-options requestpasskeyLoginOptionscalls: 1 before, 0 after on passkey-onlyrender-smoke.test.tsx"conditional UI asks for login options never on a passkey-only screen" (and "once beside the password field")WebAuthn.addVirtualAuthenticator, plus the gate mutationHow the runtime test works
packages/ui-react/tests/passkey-login-runtime.test.tsfollowsauth-expiry-runtime.test.ts. It builds the packages throughruntimePackageBuild, now inventoried inscripts/runtime-test-builds.ts. It runs a real ui-server host on loopback and bundles a small client (tests/fixtures/passkey-login-client.ts: the publicConnectionGate). The origin ishttp://localhost:<port>, because an IP address is not a valid WebAuthn RP ID. An init script reports eachPublicKeyCredential.isConditionalMediationAvailableprobe and eachnavigator.credentials.getmediation to the test through an exposed binding, which survives the reload a sign-in does.ctap2, resident key, user verification), using the app's ownregisterPasskey. The host has noBRAIN_UI_ALLOW_PASSWORD, so/auth/methodsreads passkey-only.[passkeys]warning.BRAIN_UI_ALLOW_PASSWORD=1, and a new context's authenticator gets that credential. The field appears and the screen probes (positive control for the barrier). The conditional request is usernameless forlocalhost, the stored passkey answers it, and the app signs in. After network idle there is exactly one login-options request and oneconditionalmediation.Proof
Expected length: 0, Received length: 1for the passkey-only screen. The password-and-passkey case passed before and after.Expected: 0, Received: 2).PASSKEY_ONLY_NO_LOGIN_OPTIONS,- []/+ ["POST"]. This is the request-count assertion the issue names.if (methods) return;): the password-and-passkey runtime test fails. The autofill never signs in.render-smoke.test.tsx -t passkey: 9 pass.tests/runtime-build-selection.test.tspasses with the new inventory entry.check:prpass.Collisions
bun scripts/collisions.ts --json --pr 4183at head f6e90cf: closure reports only (shared ui-react test categories and workspaces) with #3054, #3056, #3059, #3069, #3581, #3622, #4002, #4151, #4157, #4168, #4172, #4173, #4175, #4177, #4179 and #4181. No PR editslogin-screen.tsxor the new test files.{"version":1,"kind":"brain-check-pr-receipt","head":"a5d8ac2945803f9e2c45b818c6cc6c2699f2ba15","base":"origin/main","mode":"focused","startedAt":"2026-11-17T13:25:43.769Z","finishedAt":"2026-11-17T13:27:16.339Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":13281.967612},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":129.99538600000233},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":89.40745999999854},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":20.19043000000238},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":79030.384087}]}🤖 Generated with Claude Code