File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -2457,6 +2457,27 @@ async function validatePublicKey() {
2457
2457
return true ;
2458
2458
}
2459
2459
2460
+ function validateExtensions ( ) {
2461
+ const extensions = this . authnrData . get ( "webAuthnExtensions" ) ;
2462
+ const shouldHaveExtensions = this . authnrData . get ( "flags" ) . has ( "ED" ) ;
2463
+
2464
+ if ( shouldHaveExtensions ) {
2465
+ if ( Array . isArray ( extensions ) &&
2466
+ extensions . every ( item => typeof item === "object" )
2467
+ ) {
2468
+ this . audit . journal . add ( "webAuthnExtensions" ) ;
2469
+ } else {
2470
+ throw new Error ( "webAuthnExtensions aren't valid" ) ;
2471
+ }
2472
+ } else {
2473
+ if ( extensions !== undefined ) {
2474
+ throw new Error ( "unexpected webAuthnExtensions found" ) ;
2475
+ }
2476
+ }
2477
+
2478
+ return true ;
2479
+ }
2480
+
2460
2481
async function validateUserHandle ( ) {
2461
2482
let userHandle = this . authnrData . get ( "userHandle" ) ;
2462
2483
@@ -2550,6 +2571,7 @@ function attach(o) {
2550
2571
validateAaguid,
2551
2572
validateCredId,
2552
2573
validatePublicKey,
2574
+ validateExtensions,
2553
2575
validateFlags,
2554
2576
validateUserHandle,
2555
2577
validateCounter,
@@ -2999,6 +3021,7 @@ class Fido2Result {
2999
3021
await this . validateRawAuthnrData ( ) ;
3000
3022
await this . validateRpIdHash ( ) ;
3001
3023
await this . validateFlags ( ) ;
3024
+ await this . validateExtensions ( ) ;
3002
3025
}
3003
3026
3004
3027
async create ( req , exp ) {
Original file line number Diff line number Diff line change @@ -43550,6 +43550,7 @@ class Fido2Result {
43550
43550
await this.validateRawAuthnrData();
43551
43551
await this.validateRpIdHash();
43552
43552
await this.validateFlags();
43553
+ await this.validateExtensions();
43553
43554
}
43554
43555
async create(req, exp) {
43555
43556
if (typeof req !== "object") {
@@ -43938,6 +43939,23 @@ async function validatePublicKey() {
43938
43939
this.audit.journal.add("credentialPublicKeyPem");
43939
43940
return true;
43940
43941
}
43942
+ function validateExtensions() {
43943
+ const extensions7 = this.authnrData.get("webAuthnExtensions");
43944
+ const shouldHaveExtensions = this.authnrData.get("flags").has("ED");
43945
+ if (shouldHaveExtensions) {
43946
+ if (Array.isArray(extensions7) && extensions7.every((item)=>typeof item === "object"
43947
+ )) {
43948
+ this.audit.journal.add("webAuthnExtensions");
43949
+ } else {
43950
+ throw new Error("webAuthnExtensions aren't valid");
43951
+ }
43952
+ } else {
43953
+ if (extensions7 !== undefined) {
43954
+ throw new Error("unexpected webAuthnExtensions found");
43955
+ }
43956
+ }
43957
+ return true;
43958
+ }
43941
43959
async function validateUserHandle() {
43942
43960
let userHandle = this.authnrData.get("userHandle");
43943
43961
if (userHandle === undefined || userHandle === null || userHandle === "") {
@@ -44010,6 +44028,7 @@ function attach(o105) {
44010
44028
validateAaguid,
44011
44029
validateCredId,
44012
44030
validatePublicKey,
44031
+ validateExtensions,
44013
44032
validateFlags,
44014
44033
validateUserHandle,
44015
44034
validateCounter,
You can’t perform that action at this time.
0 commit comments