diff --git a/crates/aether-gateway/frontdoor/src/request_id.rs b/crates/aether-gateway/frontdoor/src/request_id.rs index a0233e118..65bebef9e 100644 --- a/crates/aether-gateway/frontdoor/src/request_id.rs +++ b/crates/aether-gateway/frontdoor/src/request_id.rs @@ -25,26 +25,7 @@ pub fn short_request_id(value: &str) -> String { } fn looks_like_uuid(value: &str) -> bool { - let bytes = value.as_bytes(); - if bytes.len() != 36 { - return false; - } - - for (index, byte) in bytes.iter().enumerate() { - let is_hyphen = matches!(index, 8 | 13 | 18 | 23); - if is_hyphen { - if *byte != b'-' { - return false; - } - continue; - } - - if !byte.is_ascii_hexdigit() { - return false; - } - } - - true + value.len() == 36 && uuid::Uuid::parse_str(value).is_ok() } #[cfg(test)] diff --git a/crates/aether-oauth/src/provider/providers/kiro.rs b/crates/aether-oauth/src/provider/providers/kiro.rs index 921a87e69..27ea76f23 100644 --- a/crates/aether-oauth/src/provider/providers/kiro.rs +++ b/crates/aether-oauth/src/provider/providers/kiro.rs @@ -581,12 +581,7 @@ pub fn normalize_kiro_machine_id(raw: &str) -> Option { if raw.len() == 64 && raw.bytes().all(|byte| byte.is_ascii_hexdigit()) { return Some(raw.to_ascii_lowercase()); } - if raw.len() == 36 - && raw.chars().enumerate().all(|(idx, ch)| match idx { - 8 | 13 | 18 | 23 => ch == '-', - _ => ch.is_ascii_hexdigit(), - }) - { + if raw.len() == 36 && uuid::Uuid::parse_str(raw).is_ok() { let normalized = raw.replace('-', "").to_ascii_lowercase(); return Some(format!("{normalized}{normalized}")); }