Fix parsing errors in ctap_parse_hmac_secret
#582
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.
saltEnc
type was not checked causing an assertion incbor_value_copy_byte_string
to fail.Reproduce using solo-python: Go to
HmacSecretExtension
inextensions.py
in python-fido2 and replace2: salt_enc
by2: "hey"
, runsolo key challenge-response
.Parameters could be omitted by duplicating known keys, causing parsed_count to increase anyway. This causes reading later on of arrays that are still 0.
Reproduce using solo-python: Go to
HmacSecretExtension
inextensions.py
in python-fido2 and replace1: key_agreement
by-42: True
, then go todump_dict
incbor.py
in python-fido2 and replace it by:and run
solo key challenge-response
.This will duplicate
saltEnc(2)
while removingkeyAgreement(1)
, so the total number of keys will remain 3, whichctap_parse_hmac_secret
will happily accept. You can also choose other parameters to duplicate. We cannot directly add a duplicate key to thedict
because Python will ignore it.Is there maybe somewhere that regression tests for this can be added? Maybe I could add something to solokeys/fido2-tests, if that's the right place for this.