fix(browser): prevent registration-induced crash (#6799)

Fixed a bug where `authenticatorSelection` may be undefined and cause
the extension to crash when attempting to register a new credential.

Co-authored-by: SmithThe4th <gsmith@bitwarden.com>
This commit is contained in:
Jared L 2023-12-05 06:57:17 +11:00 committed by GitHub
parent e980a778de
commit e961761ee9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -62,9 +62,9 @@ navigator.credentials.create = async (
}
const fallbackSupported =
(options?.publicKey?.authenticatorSelection.authenticatorAttachment === "platform" &&
(options?.publicKey?.authenticatorSelection?.authenticatorAttachment === "platform" &&
browserNativeWebauthnPlatformAuthenticatorSupport) ||
(options?.publicKey?.authenticatorSelection.authenticatorAttachment !== "platform" &&
(options?.publicKey?.authenticatorSelection?.authenticatorAttachment !== "platform" &&
browserNativeWebauthnSupport);
try {
const response = await messenger.request(