Skip to content

Commit fe400c0

Browse files
committed
fixed validator for extensions
1 parent 8c0b097 commit fe400c0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/validator.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,20 @@ async function validatePublicKey() {
613613
return true;
614614
}
615615

616+
function validateExtensions() {
617+
const extensions = this.authnrData.get("webAuthnExtensions");
618+
619+
if (extensions === undefined ||
620+
Array.isArray(extensions) &&
621+
extensions.every(item => typeof item === "object")
622+
) {
623+
this.audit.journal.add("webAuthnExtensions");
624+
return true;
625+
}
626+
627+
throw new Error("unable to validate webAuthnExtensions");
628+
}
629+
616630
async function validateUserHandle() {
617631
let userHandle = this.authnrData.get("userHandle");
618632

@@ -706,6 +720,7 @@ function attach(o) {
706720
validateAaguid,
707721
validateCredId,
708722
validatePublicKey,
723+
validateExtensions,
709724
validateFlags,
710725
validateUserHandle,
711726
validateCounter,

0 commit comments

Comments
 (0)