fix: allow :, . in SSDs in auth cookie

This commit is contained in:
dr-frmr 2024-12-04 12:20:32 -05:00
parent 41714aad7b
commit f602811a03
No known key found for this signature in database

View File

@ -376,10 +376,12 @@ async fn login_handler(
let cookie = match info.subdomain.unwrap_or_default().as_str() {
"" => format!("kinode-auth_{our}={token};"),
subdomain => {
// enforce that subdomain string only contains a-z, 0-9, and -
// enforce that subdomain string only contains a-z, 0-9, ., :, and -
let subdomain = subdomain
.chars()
.filter(|c| c.is_ascii_alphanumeric() || c == &'-')
.filter(|c| {
c.is_ascii_alphanumeric() || c == &'-' || c == &':' || c == &'.'
})
.collect::<String>();
format!("kinode-auth_{our}@{subdomain}={token};")
}