From 7765d12ec5996b0273a04619d5fb2d59d366f396 Mon Sep 17 00:00:00 2001 From: Brian Charbonneau Date: Sat, 8 Aug 2026 18:45:30 -0700 Subject: [PATCH] fix(desktop): trust native roots for relay websockets --- desktop/src-tauri/Cargo.lock | 2 +- desktop/src-tauri/Cargo.toml | 4 +++- desktop/src-tauri/src/native_websocket.rs | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/desktop/src-tauri/Cargo.lock b/desktop/src-tauri/Cargo.lock index 9feecbee01c..cba984613f3 100644 --- a/desktop/src-tauri/Cargo.lock +++ b/desktop/src-tauri/Cargo.lock @@ -10921,11 +10921,11 @@ dependencies = [ "futures-util", "log", "rustls", + "rustls-native-certs", "rustls-pki-types", "tokio", "tokio-rustls", "tungstenite 0.29.0", - "webpki-roots 0.26.11", ] [[package]] diff --git a/desktop/src-tauri/Cargo.toml b/desktop/src-tauri/Cargo.toml index fd58f27878a..16f8b2f7004 100644 --- a/desktop/src-tauri/Cargo.toml +++ b/desktop/src-tauri/Cargo.toml @@ -77,7 +77,9 @@ infer = "0.19" hex = "0.4" ed25519-dalek = "=3.0.0-rc.0" tokio = { version = "1", features = ["fs", "sync", "rt", "macros", "time", "net", "io-util"] } -tokio-tungstenite = { version = "0.29", features = ["rustls-tls-webpki-roots"] } +# Match reqwest's platform trust behavior so native WebSockets can reach +# relays secured by an OS-trusted private CA. +tokio-tungstenite = { version = "0.29", features = ["rustls-tls-native-roots"] } tokio-util = { version = "0.7", features = ["rt"] } bytes = "1" futures-util = "0.3" diff --git a/desktop/src-tauri/src/native_websocket.rs b/desktop/src-tauri/src/native_websocket.rs index 128f2df79dd..e714f0a75d7 100644 --- a/desktop/src-tauri/src/native_websocket.rs +++ b/desktop/src-tauri/src/native_websocket.rs @@ -349,6 +349,22 @@ mod tests { Channel::new(|_: InvokeResponseBody| Ok(())) } + #[tokio::test] + #[ignore = "requires BUZZ_TEST_WSS_URL and network access"] + async fn configured_wss_trusts_native_platform_roots() { + install_crypto_provider(); + let url = std::env::var("BUZZ_TEST_WSS_URL") + .expect("BUZZ_TEST_WSS_URL must name the WSS endpoint to verify"); + + tokio::time::timeout( + CONNECT_TIMEOUT, + tokio_tungstenite::connect_async(url.as_str()), + ) + .await + .expect("configured WSS endpoint should complete before the connection timeout") + .expect("configured WSS endpoint should trust the platform certificate store"); + } + #[tokio::test] async fn secure_websocket_reaches_tls_without_panicking() { install_crypto_provider();