Skip to content

Commit 7a69ecb

Browse files
committed
Don't pass empty transport list to authenticator
1 parent 4ce0231 commit 7a69ecb

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

  • xyz-iinuwa-credential-manager-portal-gtk/src

xyz-iinuwa-credential-manager-portal-gtk/src/dbus.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use gettextrs::{gettext, LocaleCategory};
88
use gtk::{gio, glib};
99

1010
use libwebauthn::ops::webauthn::{Assertion, GetAssertionRequest, MakeCredentialRequest, MakeCredentialResponse, UserVerificationRequirement};
11-
use libwebauthn::proto::ctap2::{Ctap2MakeCredentialResponse, Ctap2PublicKeyCredentialRpEntity, Ctap2PublicKeyCredentialUserEntity};
11+
use libwebauthn::proto::ctap2::{Ctap2PublicKeyCredentialDescriptor, Ctap2PublicKeyCredentialRpEntity, Ctap2PublicKeyCredentialUserEntity};
1212
use zbus::zvariant::{DeserializeDict, SerializeDict, Type};
1313
use zbus::{fdo, interface, connection::{self, Connection}, Result};
1414

@@ -471,12 +471,18 @@ impl GetCredentialRequest {
471471
let options = self.public_key.as_ref().unwrap();
472472
let request: webauthn::GetCredentialOptions = serde_json::from_str(&options.request_json)
473473
.map_err(|e| webauthn::Error::Internal(format!("Invalid request JSON: {:?}", e)))?;
474-
let allow = request.allow_credentials.iter()
474+
let mut allow: Vec<Ctap2PublicKeyCredentialDescriptor> = request.allow_credentials.iter()
475475
.filter_map(|cred| {
476-
if cred.cred_type != "public-key" { None }
477-
else { cred.try_into().ok() }
476+
if cred.cred_type == "public-key" { cred.try_into().ok() }
477+
else { None }
478478
})
479479
.collect();
480+
// TODO: The allow is returning an empty list instead of either None or a list of transports.
481+
// This should be investigated, but this is just a UI hint and isn't necessary to pass to the authenticator.
482+
// Just removing it for now.
483+
for c in allow.iter_mut() {
484+
c.transports = None;
485+
}
480486
let (origin, is_cross_origin) = match (self.origin.as_ref(), self.is_same_origin.as_ref()) {
481487
(Some(origin), Some(is_same_origin)) => (origin.to_string(), !is_same_origin),
482488
(Some(origin), None) => (origin.to_string(), true),

0 commit comments

Comments
 (0)