Closed WorldThirteen closed 1 year ago
@WorldThirteen thank you for the thorough breakdown of where exactly this was failing! I've published a fix for this as @simplewebauthn/server@7.3.0, which is available now. Please give it a try and report back if it still doesn't fix the issue.
Describe the issue
As of June 3, 2023, MetadataService could not initialize metadata from the default FIDO Alliance MDS ('https://mds.fidoalliance.org/).
Reproduction Steps
MetadataService.initialize()
.https://mds.fidoalliance.org
withMetadataService.getStatement('ee882879-721c-4913-9775-3dfcce97072a')
undefined
value.Expected behavior
...
aaguid
.Code Samples + WebAuthn Options and Responses
Logs of the MetadataService are:
Here is a test code that might be helpful for reproduction. The fetch was not mocked intentionally to receive actual Metadata BLOB.
metadataService.test.ts
```ts import fetch from 'cross-fetch'; import { MetadataService, BaseMetadataService } from './metadataService'; describe('Get known aaguid metadata statement for live metadata BLOB', () => { test('should return actual statement for a known aagiud', async () => { const service = new BaseMetadataService(); await service.initialize(); const statement = await service.getStatement('ee882879-721c-4913-9775-3dfcce97072a'); console.log('statement', statement); expect(statement).toBeDefined(); }); }); ```Dependencies
SimpleWebAuthn Libraries
Additional context
The investigation showed that certificate normalization missed the case when PEM includes extra whitespaces, which was the case for one of the certificates in the path (notice the leading whitespace chars at the beginning of each line:
After fixing this locally by modifying
convertPEMToBytes
helper, I found another error:It seems that the official FIDO MDN now using RSA instead of the expected EC2.
verifyJWT
helper to support RSA usingisoCrypto/verifyRSA.ts
, metadata was successfully validated, and metadata for sample AAGUID was obtained.These modifications could be looked at here: https://github.com/MasterKale/SimpleWebAuthn/compare/master...WorldThirteen:SimpleWebAuthn:w13-metadata-service-june-fix?expand=1
@MasterKale, would you like to receive a PR with the fixes I mentioned in the "Additional context" section?