Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

- ui: Display restart reason in case of premature failure
- daemon: Stop retrying a transport after 5 consecutive failures before user interaction; other transports keep running.
- daemon: Treat Debian's Firefox ESR (app ID `firefox-esr`) as a privileged client, like the other Firefox builds
- daemon: Build the list of devices offered to the user from libwebauthn's `available_transports()`, the same source discovery uses (#32)
- ui: Pass the caller's activation token to the compositor when showing the dialog, so it can take focus when the requesting window is in the background (#152)
- ui: Disable core dumps for the UI process, which handles typed PINs. Build with `-Denable_core_dumps=true` to allow them for debugging (#209)
Expand Down
30 changes: 28 additions & 2 deletions credentialsd/src/gateway/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ fn check_origin_from_app(
"org.mozilla.firefox",
"firefox",
"firefox-developer-edition",
// Debian's Firefox ESR, launched from firefox-esr.desktop
"firefox-esr",
Comment thread
kpanuragh marked this conversation as resolved.
Resolved
"xyz.iinuwa.credentialsd.DemoCredentialsUi",
];
let mut privileged = trusted_clients.contains(&app_id.as_ref());
Expand Down Expand Up @@ -537,9 +539,11 @@ impl Display for WebAuthnError {

#[cfg(test)]
mod test {
use crate::webauthn::{NavigationContext, Origin};
use crate::webauthn::{AppId, NavigationContext, Origin};

use super::{WebAuthnError, check_origin_from_privileged_client};
use super::{
RequestKind, WebAuthnError, check_origin_from_app, check_origin_from_privileged_client,
};

fn check_same_origin(origin: &str) -> Result<NavigationContext, WebAuthnError> {
let origin = origin.parse().unwrap();
Expand All @@ -561,4 +565,26 @@ mod test {
Err(WebAuthnError::SecurityError)
))
}

fn request_kind_for_app(app_id: &str) -> RequestKind {
let app_id: AppId = app_id.parse().unwrap();
let origin = "https://example.com".parse().unwrap();
check_origin_from_app(&app_id, origin, None).unwrap()
}

#[test]
fn test_firefox_esr_is_privileged() {
assert!(matches!(
request_kind_for_app("firefox-esr"),
RequestKind::Privileged { .. }
))
}

#[test]
fn test_unknown_app_is_unprivileged() {
assert!(matches!(
request_kind_for_app("com.example.App"),
RequestKind::Unprivileged(_)
))
}
}