From b01984addb075f411b24d4c427ac42cc44ebbe8f Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 30 Jun 2025 17:20:55 +0200 Subject: [PATCH] fix(phoenix-channel): replace all non-ASCII chars in user agent (#9725) HTTP headers only reliably support ASCII characters. We include information like the user's kernel build name in there and therefore need to strip non-ASCII characters from that to avoid encoding errors. Fixes: #9706 --- rust/connlib/phoenix-channel/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rust/connlib/phoenix-channel/src/lib.rs b/rust/connlib/phoenix-channel/src/lib.rs index e04a7b6dc..89851ce37 100644 --- a/rust/connlib/phoenix-channel/src/lib.rs +++ b/rust/connlib/phoenix-channel/src/lib.rs @@ -825,6 +825,8 @@ fn make_request(url: Url, host: String, user_agent: String) -> Request { OsRng.fill_bytes(&mut r); let key = base64::engine::general_purpose::STANDARD.encode(r); + let user_agent = user_agent.replace(|c: char| !c.is_ascii(), ""); + Request::builder() .method("GET") .header("Host", host)