Repository navigation
feat: expose WebAuthn hybrid transport via 'webauthn-hybrid-request' - #55427
Open
adamant-pwn wants to merge 3 commits into
Open
adamant-pwn wants to merge 3 commits into
adamant-pwn wants to merge 3 commits into
Conversation
Chromium's FIDO layer asks its embedder to collect a PIN through
FidoRequestHandlerBase::Observer::SupportsPIN()/CollectPIN(). Electron's
authenticator request delegate left those at the content-layer defaults
(no PIN support), so on platforms without a system WebAuthn UI — notably
Linux — a security key that requires user verification could never
complete a request: there was nowhere to ask for the PIN.
Implement the PIN observer hooks and bridge them to a new session event,
'collect-webauthn-pin', following the same pattern as
'select-webauthn-account':
- SupportsPIN() reports true only while a listener is registered for the
event, so PIN collection is strictly opt-in and existing apps keep
their current behavior (e.g. userVerification 'preferred' requests
continue to complete without UV rather than being routed into a PIN
exchange nothing can service).
- CollectPIN() emits the event with the relying party id, the reason
('challenge' | 'set' | 'change'), the error from a failed previous
attempt, the authenticator's minimum PIN length, and the remaining
attempts before hard lock. The listener answers through a callback;
calling it with no arguments cancels the request.
- Entries are validated locally with device::pin::ValidatePIN before
being sent to the authenticator, re-emitting the event with 'error'
set instead of consuming one of the limited retry attempts on a PIN
that cannot possibly be accepted — mirroring Chrome's PIN dialog.
- StartBioEnrollment() dismisses inline biometric enrollment
immediately (the equivalent of Chrome's "skip" button) so that
makeCredential on a biometric-capable but unenrolled key proceeds
instead of waiting on UI that will never appear.
Co-Authored-By: Claude Fable 5 <[email protected]>
… specs Chromium's AuthTokenRequester already validates every entered PIN (length, encoding, same as the current PIN) and asks again through CollectPIN() with the error set, so Electron no longer validates it a second time with its own rules. A callback from an earlier prompt in the same request is ignored, so a late answer to a superseded prompt cannot answer the current one. Specs on the simulated UV-locked security key cover a correct, wrong, too-short and cancelled PIN. The no-listener warning now names the event that enables PIN entry, and the docs describe `error` and `minPinLength` as Chromium reports them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Chromium adds the hybrid (caBLE v2) transport to every WebAuthn request,
but only creates the discovery once the embedder configures a QR
generator key in ConfigureDiscoveries. Electron never did, so a request
that a site expected to serve over hybrid transport sat forever with no
UI and no error.
Override ConfigureDiscoveries to generate the key, emit a new session
event 'webauthn-hybrid-request' carrying the FIDO:/ QR payload for the
app to render, and configure the discovery only when a listener accepted
the event. Store the Bluetooth callbacks so the OS permission prompt is
requested once the transport enumeration reports it pending. Emit
'webauthn-hybrid-request-completed' when the request ends so the app can
dismiss its QR code.
Requests with conditional or passkey-upgrade UI presentation are
skipped, as are platforms where Chromium would not create the discovery
(no BLE support, or Windows 11 which implements hybrid natively).
Assisted-By: Claude Fable 5.1, Claude Code
[Rebased onto collect-webauthn-pin: reuse the delegate's GetSession(),
RequestTypeName() returns std::string_view for current gin, specs ported
from mocha/chai to vitest; the hybrid specs enable the virtual
authenticator UI and pick an account for discoverable get().
With a lone PIN-protected security key, Chromium asks for its PIN
without waiting for a touch, which binds the request to that key, so a
phone scanning the QR code could never connect. Added: answering
'collect-webauthn-pin' with { useAnotherDevice: true } starts the
request over, like Chrome's "use another device", reusing the QR key so
the code stays valid and holding the Bluetooth adapter across the restart
so BlueZ does not refuse the new scan while the old one stops.
Dropped turning Bluetooth on automatically when it is off: without UI to
ask, that is the user's decision; the docs say it must be on.
-- Oleksandr Kulkov]
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
💖 Thanks for opening this pull request! 💖 Semantic PR titlesWe use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of commit messages with semantic prefixes:
Commit signingThis repo enforces commit signatures for all incoming PRs. PR tipsThings that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
1 task done
Merged
1 task done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
Depends on #55426; only the last commit is new here.
Revives #53733 by @jsilets, which has unsigned commits and conflicts. The commit keeps Joshua's authorship; I rebased it onto #55426, ported its specs to vitest and made the two changes below. Happy to close this if Joshua would rather continue in #53733.
Electron never configures Chromium's hybrid ("use a phone") discovery, so a request that a site expects to finish on a phone hangs with no UI. This emits
webauthn-hybrid-requestwith theFIDO:/payload for the app to show as a QR code, enables hybrid only while a listener exists, and emitswebauthn-hybrid-request-completedwhen the request ends.Changes from #53733:
collect-webauthn-pinwith{ useAnotherDevice: true }restarts the request with the same QR code, like Chrome's "use another device".Tested on Linux with a YubiKey 5 and a Galaxy S25 Ultra on github.com, with and without the key plugged in.
Open question: the event is offered whenever Bluetooth LE is supported, even while Bluetooth is off. Should it require Bluetooth to be on?
AI assistance: the original commit and my changes were written with Claude Code; I tested them on hardware.
Checklist
npm testpassesnpm teston Linux: 57 failures, all of which also fail on unmodifiedmainat 3dfc698 in the same environment; the new specs pass.Release Notes
Notes: Added
webauthn-hybrid-requestsession events for phone passkey sign-in.