webauthn: stop broadcasting all credentials at login, add discoverable + scoped flow with username-claim gate` #365
No reviewers
Labels
No labels
Compat/Breaking
Component/Enclave-Builder
Component/Infrastructure
Deploy/BYOC
Deploy/Full-managed
Deploy/Self-hosted
Interface/API
Interface/CLI
Interface/Git
Interface/Web
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority/Critical
Priority/High
Priority/Low
Priority/Medium
Reviewed/Confirmed
Reviewed/Duplicate
Reviewed/Invalid
Reviewed/Won't Fix
Status/Abandoned
Status/Blocked
Status/Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
public/platform!365
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refs/pull/365/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adapts the login flows to usernames (includes a DB migration). Tested with unit + e2e tests and manually end-to-end.
Note this covers the non-resident path; resident/discoverable browser coverage (Chrome virtual authenticator) is a planned follow-up.Finding 1 — username-scoped login can still authenticate a different resident account
The username-scoped login path still falls back to a discoverable/decoy ceremony in cases where the supplied username is unknown or where the known user has zero credentials. In those branches, the finish path resolves whichever resident credential the browser/phone returns and creates a session for that credential's user.
That means if a caller enters
alice, but the server takes the decoy/discoverable path, a browser/phone can still complete withbob's resident credential and log in asbob. This avoids an immediate username-enumeration response, but it makes a username-scoped login not actually scoped in those branches.Relevant paths I looked at:
src/gateway/src/handlers.rs:1082-1147src/gateway/src/handlers.rs:1310-1351src/gateway/src/handlers.rs:1966-1993Suggested fix: make
AuthStatecarry expected-user/decoy context. For username-scoped decoys or known-zero-credential cases, verify the finished credential belongs to the expected user; if there is no expected user, consume the ceremony but return a generic login failure instead of creating a session.Finding 4 — CLI register prompt lacks the noninteractive guard added for login
Login now correctly fails fast in noninteractive mode if no username is provided, but register still calls
prompt_for_claimed_username()directly when--usernameis absent or empty.In a noninteractive context, EOF can produce an empty username and then fail later at the server with a less clear error.
Relevant path:
src/cli/src/lib.rs:8384-8388Suggested fix: reuse the same
is_terminalguard pattern that the login path uses before prompting for a username.@vkobel I previously had a ticket for optionally collecting email at registration - https://codeberg.org/caution/platform/issues/142 - is this already captured in this PR?
if so, I'll close 142
Hey @xenushka — not captured in this PR. #365 is about usernames (discoverable credentials, username claiming, login hardening). Email at registration from #142 is a separate concern; users can already add an email from account settings, but the optional collection step at signup isn't implemented here.