Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inject passkeys scripts at document_start #2432

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

varjolintu
Copy link
Member

@varjolintu varjolintu commented Jan 5, 2025

Loads passkey injection script at document start. It gives a higher probability to catch WebAuthn requests made by the browser. There are several sites that do this before the document loading is finished.

Also wraps the content of passkeys.js inside async so the variables and functions will no leak to the site.

Fixes #2431.
Fixes #2434.

Testing strategy

Manually. If Chromium based browser is used, the manifest_chromium.json must be copied manually over the default manifest.json.

Type of change

  • ✅ Refactor (significant modification to existing code)

@varjolintu varjolintu marked this pull request as draft January 5, 2025 13:21
@varjolintu varjolintu changed the title Load passkeys scripts at document_start Inject passkeys scripts at document_start Jan 5, 2025
@dionorgua
Copy link

@varjolintu please let me know you need more testing from my side with Ping ID

@varjolintu varjolintu force-pushed the fix/load_passkeys_scripts_at_document_start branch from 79ac64f to a50483c Compare January 8, 2025 16:19
@varjolintu varjolintu marked this pull request as ready for review January 8, 2025 16:31
@varjolintu varjolintu added this to the 1.9.7 milestone Jan 8, 2025
@varjolintu varjolintu requested a review from droidmonkey January 8, 2025 16:32
@droidmonkey
Copy link
Member

Will give this branch a solid test today

@a2kolbasov
Copy link
Contributor

Manually tested in Firefox. On sites

the error is fixed, a passkey request occurs on the first try.

On https://app.simplelogin.io/ the script still doesn't have time to override properties before a request.

(location of console.debug)
diff --git a/keepassxc-browser/content/passkeys.js b/keepassxc-browser/content/passkeys.js
index 4ca7e9c..3da1638 100644
--- a/keepassxc-browser/content/passkeys.js
+++ b/keepassxc-browser/content/passkeys.js
@@ -207,6 +207,7 @@
         Object.defineProperty(window.PublicKeyCredential, 'isUserVerifyingPlatformAuthenticatorAvailable', {
             value: isUserVerifyingPlatformAuthenticatorAvailable,
         });
+        console.debug('[*] kpxc-passkeys loaded');
     } catch (err) {
         console.log('Cannot override navigator.credentials: ', err);
     }

app.simplelogin.io console

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants