fix(webauthn): allow PRF inputs of any length (fix #209)#211
Open
AlfioEmanueleFresta wants to merge 2 commits into
Open
fix(webauthn): allow PRF inputs of any length (fix #209)#211AlfioEmanueleFresta wants to merge 2 commits into
AlfioEmanueleFresta wants to merge 2 commits into
Conversation
Split PRFValue into PrfInputValue (Vec<u8>) for variable-length salt inputs and PrfOutputValue ([u8; 32]) for the fixed-size hmac-secret output. Per W3C WebAuthn L3 §10.1.4, PRF salt inputs are BufferSources of any length; the existing SHA-256 prefix-hashing already produces a 32-byte salt for CTAP2 hmac-secret regardless of input length. Adds unit tests for variable-length and empty inputs, and a virtual- device test exercising 0-byte, 7-byte, and 100-byte salts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #209.
Split
PRFValueintoPrfInputValue(Vec<u8>, variable-length salt inputs) andPrfOutputValue([u8; 32], fixed-length hmac-secret outputs).Spec: W3C WebAuthn L3 §10.1.4 — PRF salt inputs are
BufferSources of any length; the client hashes them viaSHA-256("WebAuthn PRF" || 0x00 || input)before CTAP2 hmac-secret. The hashing was already in place; only the input type was over-constrained.Tests
eval_by_credentialvariable-length, plus un-#[ignore]'dtest_request_from_json_prf_extension.test_webauthn_prf_variable_length_inputexercises 0/7/100-byte salts end-to-end and asserts PRF determinism.