mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-21 11:35:34 +01:00
[PM-4704] feat: filter non-webauthn calls to credmanager apis (#6803)
This commit is contained in:
parent
ffab1e31e2
commit
e88d0acc8d
@ -66,6 +66,10 @@ navigator.credentials.create = async (
|
||||
options?: CredentialCreationOptions,
|
||||
abortController?: AbortController
|
||||
): Promise<Credential> => {
|
||||
if (!isWebauthnCall(options)) {
|
||||
return await browserCredentials.create(options);
|
||||
}
|
||||
|
||||
const fallbackSupported =
|
||||
(options?.publicKey?.authenticatorSelection.authenticatorAttachment === "platform" &&
|
||||
browserNativeWebauthnPlatformAuthenticatorSupport) ||
|
||||
@ -106,6 +110,10 @@ navigator.credentials.get = async (
|
||||
options?: CredentialRequestOptions,
|
||||
abortController?: AbortController
|
||||
): Promise<Credential> => {
|
||||
if (!isWebauthnCall(options)) {
|
||||
return await browserCredentials.get(options);
|
||||
}
|
||||
|
||||
const fallbackSupported = browserNativeWebauthnSupport;
|
||||
|
||||
try {
|
||||
@ -141,6 +149,10 @@ navigator.credentials.get = async (
|
||||
}
|
||||
};
|
||||
|
||||
function isWebauthnCall(options?: CredentialCreationOptions | CredentialRequestOptions) {
|
||||
return options && "publicKey" in options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for window to be focused.
|
||||
* Safari doesn't allow scripts to trigger webauthn when window is not focused.
|
||||
|
Loading…
Reference in New Issue
Block a user