1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00

PM-19138: Add try-catch to desktop-autofill (#13964)

This commit is contained in:
Anders Åberg
2025-03-31 21:53:09 +02:00
committed by GitHub
parent 70661c014f
commit aeb3b9f94b

View File

@@ -147,7 +147,7 @@ export class DesktopAutofillService implements OnDestroy {
}
listenIpc() {
ipc.autofill.listenPasskeyRegistration((clientId, sequenceNumber, request, callback) => {
ipc.autofill.listenPasskeyRegistration(async (clientId, sequenceNumber, request, callback) => {
this.logService.warning("listenPasskeyRegistration", clientId, sequenceNumber, request);
this.logService.warning(
"listenPasskeyRegistration2",
@@ -155,19 +155,19 @@ export class DesktopAutofillService implements OnDestroy {
);
const controller = new AbortController();
void this.fido2AuthenticatorService
.makeCredential(
try {
const response = await this.fido2AuthenticatorService.makeCredential(
this.convertRegistrationRequest(request),
{ windowXy: request.windowXy },
controller,
)
.then((response) => {
);
callback(null, this.convertRegistrationResponse(request, response));
})
.catch((error) => {
} catch (error) {
this.logService.error("listenPasskeyRegistration error", error);
callback(error, null);
});
}
});
ipc.autofill.listenPasskeyAssertionWithoutUserInterface(
@@ -179,6 +179,9 @@ export class DesktopAutofillService implements OnDestroy {
request,
);
const controller = new AbortController();
try {
// For some reason the credentialId is passed as an empty array in the request, so we need to
// get it from the cipher. For that we use the recordIdentifier, which is the cipherId.
if (request.recordIdentifier && request.credentialId.length === 0) {
@@ -214,20 +217,18 @@ export class DesktopAutofillService implements OnDestroy {
);
}
const controller = new AbortController();
void this.fido2AuthenticatorService
.getAssertion(
const response = await this.fido2AuthenticatorService.getAssertion(
this.convertAssertionRequest(request),
{ windowXy: request.windowXy },
controller,
)
.then((response) => {
);
callback(null, this.convertAssertionResponse(request, response));
})
.catch((error) => {
} catch (error) {
this.logService.error("listenPasskeyAssertion error", error);
callback(error, null);
});
return;
}
},
);
@@ -235,19 +236,18 @@ export class DesktopAutofillService implements OnDestroy {
this.logService.warning("listenPasskeyAssertion", clientId, sequenceNumber, request);
const controller = new AbortController();
void this.fido2AuthenticatorService
.getAssertion(
try {
const response = await this.fido2AuthenticatorService.getAssertion(
this.convertAssertionRequest(request),
{ windowXy: request.windowXy },
controller,
)
.then((response) => {
);
callback(null, this.convertAssertionResponse(request, response));
})
.catch((error) => {
} catch (error) {
this.logService.error("listenPasskeyAssertion error", error);
callback(error, null);
});
}
});
}