Skip to content

Commit 23846c1

Browse files
committed
Omit zero AAGUIDs from runtime filter argument
1 parent 027a359 commit 23846c1

File tree

3 files changed

+78
-4
lines changed

3 files changed

+78
-4
lines changed

NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ Fixes:
3939

4040
`webauthn-server-attestation`:
4141

42+
Changes:
43+
44+
* The `AuthenticatorToBeFiltered` argument of the `FidoMetadataService` runtime
45+
filter now omits zero AAGUIDs.
46+
4247
Fixes:
4348

4449
* Fixed various typos and mistakes in JavaDocs.

webauthn-server-attestation/src/main/java/com/yubico/fido/metadata/FidoMetadataService.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@ public static class AuthenticatorToBeFiltered {
432432
* The AAGUID from the <a
433433
* href="https://www.w3.org/TR/2021/REC-webauthn-2-20210408/#sctn-attested-credential-data">attested
434434
* credential data</a> of a credential about ot be registered.
435+
*
436+
* <p>This will not be present if the attested credential data contained an AAGUID of all
437+
* zeroes.
435438
*/
436439
public Optional<AAGUID> getAaguid() {
437440
return Optional.ofNullable(aaguid);
@@ -522,7 +525,7 @@ public Set<MetadataBLOBPayloadEntry> findEntries(
522525
new AuthenticatorToBeFiltered(
523526
attestationCertificateChain,
524527
metadataBLOBPayloadEntry,
525-
aaguid.orElse(null))))
528+
nonzeroAaguid.orElse(null))))
526529
.collect(Collectors.toSet());
527530

528531
log.debug(

webauthn-server-attestation/src/test/scala/com/yubico/fido/metadata/FidoMds3Spec.scala

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.node.ArrayNode
55
import com.fasterxml.jackson.databind.node.JsonNodeFactory
66
import com.fasterxml.jackson.databind.node.ObjectNode
77
import com.fasterxml.jackson.databind.node.TextNode
8+
import com.yubico.fido.metadata.FidoMetadataService.Filters.AuthenticatorToBeFiltered
89
import com.yubico.internal.util.CertificateParser
910
import com.yubico.webauthn.FinishRegistrationOptions
1011
import com.yubico.webauthn.RegistrationResult
@@ -204,8 +205,11 @@ class FidoMds3Spec extends AnyFunSpec with Matchers {
204205
def makeMds(
205206
blobTuple: (String, X509Certificate, java.util.Set[CRL]),
206207
attestationCrls: Set[CRL] = Set.empty,
207-
)(prefilter: MetadataBLOBPayloadEntry => Boolean): FidoMetadataService =
208-
FidoMetadataService
208+
)(
209+
prefilter: MetadataBLOBPayloadEntry => Boolean,
210+
filter: Option[AuthenticatorToBeFiltered => Boolean] = None,
211+
): FidoMetadataService = {
212+
val builder = FidoMetadataService
209213
.builder()
210214
.useBlob(makeDownloader(blobTuple).loadCachedBlob())
211215
.prefilter(prefilter.asJava)
@@ -215,7 +219,9 @@ class FidoMds3Spec extends AnyFunSpec with Matchers {
215219
new CollectionCertStoreParameters(attestationCrls.asJava),
216220
)
217221
)
218-
.build()
222+
filter.foreach(f => builder.filter(f.asJava))
223+
builder.build()
224+
}
219225

220226
val blobTuple = makeBlob(s"""{
221227
"legalHeader" : "Kom ihåg att du aldrig får snyta dig i mattan!",
@@ -405,6 +411,66 @@ class FidoMds3Spec extends AnyFunSpec with Matchers {
405411
_.getAaguid.toScala.contains(aaguidB)
406412
).isAttestationTrusted should be(false)
407413
}
414+
415+
describe("Zero AAGUIDs") {
416+
val zeroAaguid =
417+
new AAGUID(ByteArray.fromHex("00000000000000000000000000000000"))
418+
419+
it("are not used to find metadata entries.") {
420+
aaguidA should not equal zeroAaguid
421+
422+
val blobTuple = makeBlob(s"""{
423+
"legalHeader" : "Kom ihåg att du aldrig får snyta dig i mattan!",
424+
"nextUpdate" : "2022-12-01",
425+
"no" : 0,
426+
"entries": [
427+
${makeEntry(aaguid = Some(aaguidA))},
428+
${makeEntry(aaguid = Some(zeroAaguid))}
429+
]
430+
}""")
431+
var filterRan = false
432+
val mds = makeMds(blobTuple)(
433+
_ => true,
434+
filter = Some({ _ =>
435+
filterRan = true
436+
true
437+
}),
438+
)
439+
440+
mds.findEntries(zeroAaguid) shouldBe empty
441+
filterRan should be(false)
442+
}
443+
444+
it("are omitted in the argument to the runtime filter.") {
445+
aaguidA should not equal zeroAaguid
446+
447+
val (cert, _) = TestAuthenticator.generateAttestationCertificate()
448+
val acki: String = new ByteArray(
449+
CertificateParser.computeSubjectKeyIdentifier(cert)
450+
).getHex
451+
val blobTuple = makeBlob(s"""{
452+
"legalHeader" : "Kom ihåg att du aldrig får snyta dig i mattan!",
453+
"nextUpdate" : "2022-12-01",
454+
"no" : 0,
455+
"entries": [
456+
${makeEntry(acki = Some(Set(acki)), aaguid = Some(aaguidA))}
457+
]
458+
}""")
459+
var filterRan = false
460+
val mds = makeMds(blobTuple)(
461+
_ => true,
462+
filter = Some({ authenticatorToBeFiltered =>
463+
filterRan = true
464+
authenticatorToBeFiltered.getAaguid.toScala should be(None)
465+
true
466+
}),
467+
)
468+
469+
mds.findEntries(List(cert).asJava, zeroAaguid).size should be(1)
470+
filterRan should be(true)
471+
}
472+
}
473+
408474
}
409475

410476
describe("2.1. Check whether the status report of the authenticator model has changed compared to the cached entry by looking at the fields timeOfLastStatusChange and statusReport.") {

0 commit comments

Comments
 (0)