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

[PM-1722] gracefully fail if site prompts user for passkey on load #6089

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions apps/browser/src/vault/fido2/content/page-script.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { FallbackRequestedError } from "@bitwarden/common/vault/abstractions/fido2/fido2-client.service.abstraction";

import { WebauthnUtils } from "../../../browser/webauthn-utils";

import { MessageType } from "./messaging/message";
Expand Down Expand Up @@ -95,7 +97,12 @@
abortController?: AbortController
): Promise<Credential> => {
const fallbackSupported = browserNativeWebauthnSupport;

try {
if (options?.mediation && options.mediation !== "optional") {
throw new FallbackRequestedError();
}

Check notice on line 105 in apps/browser/src/vault/fido2/content/page-script.ts

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (EC-598-beeep-properly-store-passkeys-in-bitwarden)

ℹ New issue: Complex Method

navigator.credentials.get has a cyclomatic complexity of 12, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
const response = await messenger.request(
{
type: MessageType.CredentialGetRequest,
Expand Down
Loading