I encountered an exception which looks suspicious while I tried to verify my Webauthn authenticator using the metadataService.verify() method and when my authenticator attestationStatement (packed) looks like this : "{"alg":"ES256"}" leading to empty chain error when calling the MetaData.verifyMetadata() method.
private static List<X509Certificate> parseX5c(List<String> x5c) throws CertificateException {
=> List<X509Certificate> certChain = new ArrayList<>();
if (x5c == null || x5c.size() == 0) {
=> return certChain;
}
for (String s : x5c) {
certChain.add(JWS.parseX5c(BASE64_DECODER.decode(s)));
}
return certChain;
}
MetaData.verifyMetadata()
# at this stage the x5c is an empty list
=> if (x5c != null) {
// make a copy before we start
x5c = new ArrayList<>(x5c);
...
}
Steps to reproduce
Verify a packed attestation with no x5c
Call the metadataService.verify() method
Should not throw RuntimeException if MetaDataEntry is empty or OK
Version
Which version(s) did you encounter this bug ?
4.3.8
Context
I encountered an exception which looks suspicious while I tried to verify my Webauthn authenticator using the metadataService.verify() method and when my authenticator attestationStatement (packed) looks like this :
"{"alg":"ES256"}"
leading toempty chain
error when calling the MetaData.verifyMetadata() method.Steps to reproduce
Potential Solution
Do not create an empty list if the x5c is null.