webauthn: ensure allowCredentials[].id is an ArrayBuffer

closes gh-16439

Signed-off-by: Daniel Garnier-Moiroux <git@garnier.wf>
This commit is contained in:
Daniel Garnier-Moiroux
2025-01-17 15:07:24 +01:00
parent 60dbeba985
commit 5bf42bb7a8
2 changed files with 22 additions and 2 deletions

View File

@@ -41,8 +41,16 @@ async function authenticate(headers, contextPath, useConditionalMediation) {
}
// FIXME: Use https://www.w3.org/TR/webauthn-3/#sctn-parseRequestOptionsFromJSON
const decodedAllowCredentials = !options.allowCredentials
? []
: options.allowCredentials.map((cred) => ({
...cred,
id: base64url.decode(cred.id),
}));
const decodedOptions = {
...options,
allowCredentials: decodedAllowCredentials,
challenge: base64url.decode(options.challenge),
};