From 71413a7b3be05cf700edc7fb52d15a29c87e1296 Mon Sep 17 00:00:00 2001 From: Andreas Coroiu Date: Mon, 19 Aug 2024 10:17:15 +0200 Subject: [PATCH] [PM-6125] Handle kp.alg is string (#10285) * fix: handle cases when `kp.alg` is `string` in `createCredential` for `Fido2` * feat: simplify and move fix to mappers * fix null filter --------- Co-authored-by: Alessio Cosenza Co-authored-by: Merissa Weinstein Co-authored-by: Todd Martin --- .../src/autofill/fido2/utils/webauthn-utils.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/browser/src/autofill/fido2/utils/webauthn-utils.ts b/apps/browser/src/autofill/fido2/utils/webauthn-utils.ts index 71ed5dc000e..30dbd0b025e 100644 --- a/apps/browser/src/autofill/fido2/utils/webauthn-utils.ts +++ b/apps/browser/src/autofill/fido2/utils/webauthn-utils.ts @@ -36,10 +36,13 @@ export class WebauthnUtils { extensions: { credProps: keyOptions.extensions?.credProps, }, - pubKeyCredParams: keyOptions.pubKeyCredParams.map((params) => ({ - alg: params.alg, - type: params.type, - })), + pubKeyCredParams: keyOptions.pubKeyCredParams + .map((params) => ({ + // Fix for spec-deviation: Sites using KeycloakJS send `kp.alg` as a string + alg: Number(params.alg), + type: params.type, + })) + .filter((params) => !isNaN(params.alg)), rp: { id: keyOptions.rp.id, name: keyOptions.rp.name,