-
Notifications
You must be signed in to change notification settings - Fork 5
Use libwebauthn for JSON request parsing #116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
msirringhaus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some questions inline
| Ok(Some(hid_device)) => Ok(NfcStateInternal::Connected(hid_device)), | ||
| Ok(Some(nfc_device)) => Ok(NfcStateInternal::Connected(nfc_device)), | ||
| Ok(None) => { | ||
| let state = NfcStateInternal::Waiting; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the change made here
| .unwrap_or_else(|| { | ||
| // Default to effective domain from origin | ||
| origin | ||
| .rsplit_once('/') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is rsplit_once() really correct here? Can't there be multiple /?
| MakeCredentialRequest { | ||
| hash: client_data_hash, | ||
| origin, | ||
| String::from_utf8(make_cred_request.client_data_json()).map_err(|_| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment here linux-credentials/libwebauthn#155 (comment) I think it would be sensible for make_cred_request.client_data_json() to return a String.
|
|
||
| // Get the client data JSON from the request for response serialization | ||
| let client_data_json = | ||
| String::from_utf8(get_assertion_request.client_data_json()).map_err(|_| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
| .unwrap_or_else(|| { | ||
| // Default to effective domain from origin | ||
| origin | ||
| .rsplit_once('/') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
This PR migrates JSON request parsing to use libwebauthn's
WebAuthnIDL::from_json()trait instead of our custom parsing code. This removes ~700 lines of manual parsing in favour of the shared implementation.Changes
MakeCredentialRequest::from_json()andGetAssertionRequest::from_json()from libwebauthnMakeCredentialOptions,GetCredentialOptions,CredentialDescriptor, etc.)d97c80d25bdb974472c40de5e5031db5946ad532(from Web IDL support 2/N: response JSON serialization libwebauthn#155)Behavioral changes
Default timeout
The default timeout when not specified by the relying party changes from 300s to 60s:
credentialsd/credentialsd/src/dbus/model.rs
Line 211 in 03206d2
Allow list transports
Previously we cleared
transportsfrom credentials in the allow list as a workaround. This is no longer done - transports now pass through as-is. These are just UI hints and shouldn't affect functionality.Follow-up