Passkeys fallback: wait the window.onfocus event#2810
Passkeys fallback: wait the window.onfocus event#2810a2kolbasov wants to merge 2 commits intokeepassxreboot:developfrom
window.onfocus event#2810Conversation
|
This is clearly some bug in Firefox itself. |
|
This is an ugly workaround to what is ultimately browser behavior. The behavior should be reported to mozilla for correction. |
|
Chrome behaves differently, but still in a similar way. Disable keepassxc-browser, go to https://github.com/login, execute setTimeout(() => document.querySelector('.js-webauthn-confirm-button').click(), 5_000), switch to another tab and wait for the timer to expire. When you return, you will see the same error in the console. Browsers block requests from inactive pages, but they define its activity differently. The call from the password manager is no different (for browsers) from the code on the page that calls And the spoof of And here are examples from the WebAuthn specification: |
d502ca2 to
800d831
Compare
800d831 to
7c6b3bf
Compare
|
The same thing happens in Safari. The video shows:
safari.mp4tested on a self-written site via BrowserStack, MacOS Tahoe, Safari 26.2 I conducted additional testing. I also replaced a callback with |
Some browsers (like Firefox) reject requests to
navigator.credentials.create/getif the page is out of focus (meaning the built-in functionality -- theoriginalCredentialsvariable). When the user selects a passkey in KeePassXC-desktop, there is no focus on the page. When the request is canceled, a race begins between whether the focus returns to the page and whether theoriginalCredentialscall occurs. It depends on the operating system's window manager.If the user starts switching windows during the request, and when canceling the request, focus is returned to a non-browser, the browser will reject the request regardless of the OS.
Resolves #2493
Screenshots or videos
Testing strategy
As in #2493 (comment).
It is also possible at the time of the Passkey request:
The focus will return in DevTools and the browser will reject the request.
If you need to call the built-in library in Firefox to work with USB keys, regardless of the OS: go to
about:config, setsecurity.webauth.webauthn_enable_softtokentotrue.Type of change