Skip to content

feat: expose WebAuthn hybrid transport via 'webauthn-hybrid-request' - #55427

Open
adamant-pwn wants to merge 3 commits into
electron:mainfrom
adamant-pwn:revive-webauthn-hybrid
Open

adamant-pwn wants to merge 3 commits into
electron:mainfrom
adamant-pwn:revive-webauthn-hybrid

Conversation

@adamant-pwn

@adamant-pwn adamant-pwn commented Oct 28, 2026 •

Copy link
Copy Markdown

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-request with the FIDO:/ payload for the app to show as a QR code, enables hybrid only while a listener exists, and emits webauthn-hybrid-request-completed when the request ends.

Changes from #53733:

  • With a single PIN-protected key, Chromium asks for its PIN at once and binds the request to that key, so the phone cannot connect. Answering collect-webauthn-pin with { useAnotherDevice: true } restarts the request with the same QR code, like Chrome's "use another device".
  • Electron no longer turns Bluetooth on without asking the user.

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 test on Linux: 57 failures, all of which also fail on unmodified main at 3dfc698 in the same environment; the new specs pass.

Release Notes

Notes: Added webauthn-hybrid-request session events for phone passkey sign-in.

dguedry and others added 3 commits October 28, 2026 00:41
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]>
@welcome

welcome Bot commented Oct 28, 2026

Copy link
Copy Markdown

💖 Thanks for opening this pull request! 💖

Semantic PR titles

We 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:

  • fix: don't overwrite prevent_default if default wasn't prevented
  • feat: add app.isPackaged() method
  • docs: app.isDefaultProtocolClient is now available on Linux

Commit signing

This repo enforces commit signatures for all incoming PRs.
To sign your commits, see GitHub's documentation on Telling Git about your signing key.

PR tips

Things that will help get your PR across the finish line:

  • Follow the JavaScript, C++, and Python coding style.
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes you've made following the documentation styleguide.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

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.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants