Skip to content

feat: add 'collect-webauthn-pin' session event for security key PINs - #55426

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

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

Conversation

@adamant-pwn

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

Copy link
Copy Markdown

Description of Change

Supersedes #53351, which was closed for unsigned commits and conflicts. The first commit is @SeraVault's original change rebased onto #54355; the second relies on Chromium's own PIN validation and adds specs.

On Linux there is no system WebAuthn UI, so since #54355 a request that needs a security key PIN is cancelled. This blocks resident passkeys and any userVerification: 'required' request on a PIN-protected key (#24573).

This adds a collect-webauthn-pin session event, modelled on select-webauthn-account. It reports the relying party, why the PIN is needed, the previous error, the minimum length and the remaining attempts. The listener answers with the PIN, or with nothing to cancel. Chromium validates each entry and fires the event again with error set. PIN collection is enabled only while a listener is registered, so other apps are unaffected.

Tested on Linux with a PIN-protected YubiKey 5, including a wrong PIN and passkey sign-in on github.com.

AI assistance: both commits 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 the collect-webauthn-pin session event for security key PINs.

dguedry and others added 2 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]>
@adamant-pwn

Copy link
Copy Markdown
Author

@MarshallOfSound this picks up #53351, which you closed for unsigned commits and conflicts. The commits are now signed and rebased onto #54355. Could you approve the CI workflows when you have time? #55427 (hybrid transport) is stacked on this one.

ori-shalom added a commit to bizimind/loxel that referenced this pull request Nov 11, 2026
…45 (#1215)

* feat(loxel): ship releases on a patched Electron 45

Releases now package Electron 45.3.0 with patches that add security key
PIN entry and phone (FIDO hybrid) passkeys: electron/electron#55426 and
#55427, plus a fix so the QR code is only offered when the request can
use the phone. The patches live in packages/loxel/electron/patches/.
scripts/build-electron.ts builds both architectures on a Mac and uploads
them to R2 under an ID derived from the version and the patches;
release-loxel.yml fetches the matching build and fails if it is missing.

Moving to Electron 45 also:
- moves the data encryption key to the async safeStorage API (the
  synchronous methods are deprecated in 45 and removed in 46); a keychain
  that withholds the key no longer leads to it being replaced
- gives dev runs their own Electron data directory, so a dev app's
  browser panels don't lock the installed app's profile databases

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(loxel): show passkey QR codes for phone sign-in in browser panels

Cross-device passkeys (FIDO hybrid transport): when a page in a browser
panel asks for a passkey that a phone can provide, the patched Electron's
'webauthn-hybrid-request' session event hands Loxel a FIDO:/ QR code.
The panel that made the request shows it over its page, so a background
panel can't put one in front of the user, and hides it when the request
ends. The code is a per-request secret: it goes only to the hosting
window's renderer and is never logged. On stock Electron the listeners
never fire.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(loxel): keep Dependabot from bumping the patched Electron

A Dependabot electron bump would pass CI and then fail the release,
which needs the patched build for the exact version uploaded first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(loxel): harden the patched Electron pipeline and QR routing

From review:
- build-electron.ts: count a build as uploaded only when its checksum
  (written last) is there too; refuse a build config that points at
  another checkout; reuse a zip already built for the same ID so a
  --no-upload run only needs uploading; set the working directory per
  command; copy each zip to build/electron-dist with a build-ID marker.
- release-loxel.yml: check both architectures are in R2 before the
  version bump, so a missing build leaves no release commit or tag.
- build-app.ts: refuse a zip whose marker names another build.
- webauthn.ts: a completion from a frame outside the panels, or from an
  older request of the same webview, no longer hides a live QR code;
  the webview's destroyed listener is removed when its request ends.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: describe signing in with a passkey from your phone

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(loxel): keep the patched Electron builds in the private CI bucket

They are an input to the release, not a download, so they move from the
public release bucket to loxel-ci-private, reached with the
R2_PRIVATE_* token CI already has.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@juliusmarminge

Copy link
Copy Markdown

A macOS data point, since the docs mention Linux: the same thing happens on macOS. In T3 Code's in-app browser (Electron 44.10.1, <webview> on its own session, macOS 27), a YubiKey works with touch only when userVerification is preferred and the credential isn't discoverable. With userVerification: 'required' (webauthn.io authentication, or passkey sign-in on platform.openai.com), the key blinks or stays silent, then NotAllowedError. Chrome and Safari on the same Mac prompt for the PIN.

macOS security keys go through ElectronAuthenticatorRequestClientDelegate too, so I'd expect this PR to cover macOS as well. Would be good to say so in the docs. We'd use collect-webauthn-pin as soon as it ships.

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