Skip to content

Commit 33be166

Browse files
fixup: adapt to post-rebase API changes from #188 and #198
- GetAssertionRequest.cross_origin renamed to top_origin (#188) - Assertion no longer carries large_blob_key (#198); thread it through from Ctap2GetAssertionResponse instead
1 parent 00c188d commit 33be166

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

libwebauthn/src/ops/webauthn/large_blob.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ mod tests {
757757
relying_party_id: "example.com".into(),
758758
challenge: vec![0u8; 32],
759759
origin: "example.com".into(),
760-
cross_origin: None,
760+
top_origin: None,
761761
allow: vec![],
762762
extensions: Some(GetAssertionRequestExtensions {
763763
cred_blob: false,
@@ -794,7 +794,7 @@ mod tests {
794794
relying_party_id: "example.com".into(),
795795
challenge: vec![0u8; 32],
796796
origin: "example.com".into(),
797-
cross_origin: None,
797+
top_origin: None,
798798
allow: vec![],
799799
extensions: Some(GetAssertionRequestExtensions {
800800
cred_blob: false,

libwebauthn/src/webauthn.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ pub mod error;
22
pub mod pin_uv_auth_token;
33

44
use async_trait::async_trait;
5+
use serde_bytes::ByteBuf;
56
use tracing::{debug, error, info, instrument, trace, warn};
67

78
use crate::fido::FidoProtocol;
@@ -232,11 +233,16 @@ where
232233
)
233234
}?;
234235
let count = response.credentials_count.unwrap_or(1);
236+
// Keep the per-response largeBlobKey alongside the assertion so we can
237+
// run authenticatorLargeBlobs(get) below without leaking the key into
238+
// the WebAuthn-level `Assertion` struct (see PR #198).
239+
let mut large_blob_keys: Vec<Option<ByteBuf>> = vec![response.large_blob_key.clone()];
235240
let mut assertions = vec![response.into_assertion_output(op, self.get_auth_data())];
236241
for i in 1..count {
237242
debug!({ i }, "Fetching additional credential");
238243
// GetNextAssertion doesn't use PinUVAuthToken, so we don't need to check uv_auth_used here
239244
let response = self.ctap2_get_next_assertion(op.timeout).await?;
245+
large_blob_keys.push(response.large_blob_key.clone());
240246
assertions.push(response.into_assertion_output(op, self.get_auth_data()));
241247
}
242248

@@ -246,8 +252,8 @@ where
246252
let large_blob_read_requested = op.extensions.as_ref().and_then(|e| e.large_blob.as_ref())
247253
== Some(&GetAssertionLargeBlobExtension::Read);
248254
if large_blob_read_requested {
249-
for assertion in assertions.iter_mut() {
250-
let Some(key_vec) = assertion.large_blob_key.as_ref() else {
255+
for (assertion, key_opt) in assertions.iter_mut().zip(large_blob_keys.iter()) {
256+
let Some(key_vec) = key_opt.as_ref() else {
251257
continue;
252258
};
253259
let Ok(key) = <[u8; 32]>::try_from(key_vec.as_slice()) else {

0 commit comments

Comments
 (0)