Skip to content

Commit 2102e8e

Browse files
authored
Merge pull request #111 from linux-credentials/deserialize-user-handle
daemon: Deserialize user handle on credential creation.
2 parents e460f2c + 6964ad7 commit 2102e8e

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

credentialsd/src/dbus/model.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub(super) fn create_credential_request_try_into_ctap2(
6666
tracing::info!("JSON missing `rp` field");
6767
WebAuthnError::TypeError
6868
})?;
69-
let user =
69+
let mut user =
7070
json.get("user")
7171
.ok_or_else(|| {
7272
tracing::info!("JSON missing `user` field.");
@@ -79,6 +79,13 @@ pub(super) fn create_credential_request_try_into_ctap2(
7979
WebAuthnError::TypeError
8080
})
8181
})?;
82+
user.id = URL_SAFE_NO_PAD
83+
.decode(user.id)
84+
.map_err(|_| {
85+
tracing::info!("user ID is not a valid base64url string");
86+
WebAuthnError::TypeError
87+
})?
88+
.into();
8289
let other_options =
8390
serde_json::from_str::<webauthn::MakeCredentialOptions>(&request_value.to_string())
8491
.map_err(|e| {

0 commit comments

Comments
 (0)