mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-06-03 22:04:57 -06:00
Add option to validate keys where browser reports subdomain of domain URL
This commit is contained in:
parent
36f0620fd1
commit
19dc021246
@ -32,12 +32,17 @@ use webauthn_rs_proto::{
|
|||||||
static WEBAUTHN: LazyLock<Webauthn> = LazyLock::new(|| {
|
static WEBAUTHN: LazyLock<Webauthn> = LazyLock::new(|| {
|
||||||
let domain = CONFIG.domain();
|
let domain = CONFIG.domain();
|
||||||
let domain_origin = CONFIG.domain_origin();
|
let domain_origin = CONFIG.domain_origin();
|
||||||
let rp_id = Url::parse(&domain).map(|u| u.domain().map(str::to_owned)).ok().flatten().unwrap_or_default();
|
let rp_id = Url::parse(&domain)
|
||||||
let rp_origin = Url::parse(&domain_origin).unwrap();
|
.map(|u| u.domain().map(str::to_owned))
|
||||||
|
.ok()
|
||||||
|
.flatten()
|
||||||
|
.expect("Invalid domain part for rp_id");
|
||||||
|
let rp_origin = Url::parse(&domain_origin).expect("Invalid domain_origin for rp_origin");
|
||||||
|
|
||||||
let webauthn = WebauthnBuilder::new(&rp_id, &rp_origin)
|
let webauthn = WebauthnBuilder::new(&rp_id, &rp_origin)
|
||||||
.expect("Creating WebauthnBuilder failed")
|
.expect("Creating WebauthnBuilder failed")
|
||||||
.rp_name(&domain)
|
.rp_name(&domain)
|
||||||
|
.allow_subdomains(CONFIG.webauthn_allow_subdomains())
|
||||||
.timeout(Duration::from_millis(60000));
|
.timeout(Duration::from_millis(60000));
|
||||||
|
|
||||||
webauthn.build().expect("Building Webauthn failed")
|
webauthn.build().expect("Building Webauthn failed")
|
||||||
|
|||||||
@ -793,6 +793,9 @@ make_config! {
|
|||||||
/// Prefer IPv6 (AAAA) resolving |> This settings configures the DNS resolver to resolve IPv6 first, and if not available try IPv4
|
/// Prefer IPv6 (AAAA) resolving |> This settings configures the DNS resolver to resolve IPv6 first, and if not available try IPv4
|
||||||
/// This could be useful in IPv6 only environments.
|
/// This could be useful in IPv6 only environments.
|
||||||
dns_prefer_ipv6: bool, true, def, false;
|
dns_prefer_ipv6: bool, true, def, false;
|
||||||
|
|
||||||
|
/// Accept passkeys bound to subdomains |> This setting controls if passkeys bound to sub-domains of <Domain URL> are accepted for authentication.
|
||||||
|
webauthn_allow_subdomains: bool, false, def, false;
|
||||||
},
|
},
|
||||||
|
|
||||||
/// OpenID Connect SSO settings
|
/// OpenID Connect SSO settings
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user