Tolerate unknown AuthenticatorVersion values while deserializing #350
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I recently got a prototype FIDO_2_2 authenticator and noticed that WebAuthn operations with it fails when
userVerification: "required"
, or whenresidentKey: "required"
. I traced the root cause to the deserialization ofAuthenticatorVersion
, which is intolerant of unknown values such as"FIDO_2_2"
. This causes Firefox to downgrade to the CTAP1 protocol for any authenticator whose getInfo contains"FIDO_2_2"
(or any other unknown value, such as future versions), preventing use of any CTAP2-exclusive features with those authenticators.Reproducing the issue
Fixing the issue
This adds an
AuthenticatorVersion::Unknown
variant with#[serde(other)]
, causing unknown values to deserialize to that variant instead of being rejected. This is enough to prevent Firefox from downgrading FIDO_2_2 devices to CTAP1, so they can successfully use UV and other CTAP2-exclusive features.This PR does not add a
FIDO_2_2
variant since that would not actually add support for any features introduced in FIDO_2_2.