Skip to content

webauthn: carry hmacGetSecret from the IDL JSON to the authenticator and back - #312

Closed
maan2003 wants to merge 1 commit into
linux-credentials:masterfrom
maan2003:rho/hmac-get-secret
Closed

maan2003 wants to merge 1 commit into
linux-credentials:masterfrom
maan2003:rho/hmac-get-secret

Conversation

@maan2003

Copy link
Copy Markdown

AuthenticationExtensionsClientInputsJSON.hmacGetSecret is parsed by the IDL model but then dropped: GetAssertionRequestExtensions had no field for it, so a caller of GetAssertionRequest::prepare could only reach hmac-secret through prf, which the platform upgrades to userVerification=required (#183 / webauthn#2337). The pre-PRF client extension asks for the raw salts under the request's own userVerification, as browsers served it.

This wires it through: the JSON input becomes GetAssertionHmacOrPrfInput::HmacGetSecret on the CTAP request (prf wins when both are present), and the decrypted output is returned as clientExtensionResults.hmacGetSecret instead of prf. Salts must be 32 bytes, as before (HMACGetSecretInput). Most of the diff is the new field in existing struct literals.

Tests: test_request_from_json_hmac_get_secret_extension (JSON parse, wrong-length salt refused) and hmac_get_secret_input_is_sent_raw_and_answered_as_itself (conversion, prf precedence). Verified end to end against a CanoKey emulated by QEMU with userVerification: "discouraged": no PIN asked, the same salt agrees across assertions, another salt differs.

Motivation: a desktop service that derives a device identity from the security key and wants touch-only assertions (the spec's PRF policy requires UV, which the key's PIN would satisfy at every use).

…and back

`AuthenticationExtensionsClientInputsJSON.hmacGetSecret` was parsed and then dropped:
GetAssertionRequestExtensions had no field for it, so a caller of
GetAssertionRequest::prepare could only ask for hmac-secret through `prf`, which the
platform upgrades to userVerification=required (webauthn#2337). The pre-PRF client
extension asks for the raw salts under the request's own userVerification, as
browsers served it. It now reaches the CTAP request as
GetAssertionHmacOrPrfInput::HmacGetSecret (prf wins when both are present) and the
decrypted output comes back as `clientExtensionResults.hmacGetSecret`, not `prf`.
@maan2003

Copy link
Copy Markdown
Author

I apologize, my agent went rouge and opened a PR.

@maan2003 maan2003 closed this Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant