Repository navigation
Conversation
Contributor
|
For more information on signing commits, see GitHub's documentation on Telling Git about your signing key. |
SeraVault
force-pushed
the
feat/webauthn-pin-collection
branch
from
August 31, 2026 23:08
77c75e8 to
01699eb
Compare
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]>
SeraVault
force-pushed
the
feat/webauthn-pin-collection
branch
from
August 31, 2026 23:28
01699eb to
4af03c3
Compare
Member
|
This change won't be reviewed until the PR has signed commits and is ready for CI to run (signed commits are a pre-req here) |
Member
|
Closing this out as it's in conflict and the request for signed commits has been ignored |
6 of 7 tasks
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
On platforms without a system-level WebAuthn UI — notably Linux — a security key that requires user verification currently cannot complete a WebAuthn request in Electron. Chromium's FIDO layer asks its embedder to collect the PIN through
FidoRequestHandlerBase::Observer::SupportsPIN()/CollectPIN();ElectronAuthenticatorRequestClientDelegateleaves those at the content-layer defaults (no PIN support), so the request stalls with nowhere to ask for the PIN. (On Windows the OS's own WebAuthn dialogs handle this; on macOS the Touch ID / platform-passkeys paths from #51255 cover platform authenticators.)This PR implements the PIN observer hooks and bridges them to a new session event,
collect-webauthn-pin, following the pattern established byselect-webauthn-account:Design notes:
SupportsPIN()reports true only while a listener is registered for the event. Apps that don't listen keep today's behavior exactly — in particular,userVerification: 'preferred'requests keep completing without UV where the authenticator allows it, rather than being routed into a PIN exchange nothing can service.device::pin::ValidatePINand the event re-fires witherrorset (too-short,invalid-characters, …) instead of consuming one of the authenticator's limited retry attempts on a PIN that cannot possibly be accepted — mirroring what Chrome's PIN dialog does inline. A well-formed but wrong PIN re-fires witherror: 'wrong-pin'and an updatedattemptsRemaining.reasoncovers all three CTAP PIN ceremonies (challenge,set,change), so keys that require an initial PIN, or a PIN change after a minimum-length increase, also work.StartBioEnrollment()is dismissed immediately (the equivalent of Chrome's "skip" button, posted asynchronously per the observer contract). Without this, enabling PIN support would makemakeCredentialon a biometric-capable but unenrolled key (e.g. a fresh YubiKey Bio) hang waiting on enrollment UI that never appears.OnRetryUserVerification()is intentionally not surfaced: the token requester re-polls the authenticator automatically, so it is purely informational. It could be exposed as a follow-up event if there's interest, as couldFinishCollectToken()(a "PIN accepted, now touch your key" signal).The event/emit plumbing (session lookup, weak-pointer guards around synchronous callback re-entry, cancel-on-no-listener) deliberately matches
SelectAccountin the same file.Status / why this is a draft: this change has not yet been built against a full Electron checkout or exercised against hardware. I'm setting up an Electron build to verify compilation and to test end-to-end on Linux with FIDO2 keys that have a PIN set (the failing case that motivated this). I'll mark the PR ready once that's done — early feedback on the API shape is very welcome in the meantime.
Testing: the added spec covers the opt-in guarantee that can run in CI (a registered
collect-webauthn-pinlistener flipsSupportsPIN()on, and must not change the outcome of a request the authenticator satisfies with its own UV — the event must not fire). The PIN exchange itself can't be driven by the CDP virtual authenticator, which fakes UV internally, so that path is verified against real hardware.Per the AI contribution policy: this change was written with Claude Code (model
claude-fable-5); the commit carries aCo-Authored-Bytrailer. I have reviewed the change and am responsible for it.Checklist
npm testpasses (docs lint, TS definition generation, and spec formatting verified locally; full run pending build)Release Notes
Notes: Added the
collect-webauthn-pinsession event, enabling apps to collect a security key's PIN so that WebAuthn requests requiring user verification can complete on platforms without system WebAuthn UI (e.g. Linux).