Set pinProtocol for UV tokens when supported #197
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.
Let's say we have the following situation:
Because of some... let's call it interesting design... in the way extensions are handled, the user will pass
HmacSecretExtension
(the type) to the client. They won't pass an INSTANCE ofHmacSecretExtension
. This meanspin_protocol
on the extension object will always be null.The extension currently contains code that chooses the PIN protocol based on what the authenticator supports. So if the authenticator supports PIN protocol 2, the extension will use that.
But back up in the CTAP2 Client, we didn't choose a PIN protocol. Net effect:
pinUvAuthParam
unset (good)pinProtool
unset (BAD - this causes a default of PIN protocol version 1)There's a circular dependency in how the extensions are set up right now, where the decision of what PIN protocol to use depends on the permissions coming back from the extensions, but the extensions also need to know the PIN protocol.
My chosen solution is simple: if the authenticator supports UV tokens, always pass it the PIN protocol explicitly - even when not doing PIN auth. This doesn't break any of the existing tests in the repository, but does repair the untested path where the hmac-secret extension is being used without a PIN set on a PIN-protocol-2-supporting authenticator.