diff --git a/CHANGELOG.md b/CHANGELOG.md index ec7cc82..999fc25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## Unreleased + +### Breaking Changes + +* Split websocket TLS backend selection into explicit feature flags: + `tungstenite-native-tls`, `tungstenite-rustls-native-roots`, and + `tungstenite-rustls-webpki-roots`. The base `tungstenite` feature no longer + forces `native-tls`. + ## 0.9.0 - 2026-03-25 ### Breaking Changes diff --git a/Cargo.lock b/Cargo.lock index 9305a06..2dca3e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -597,6 +597,17 @@ dependencies = [ "version_check", ] +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + [[package]] name = "getrandom" version = "0.3.4" @@ -1426,6 +1437,20 @@ dependencies = [ "web-sys", ] +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + [[package]] name = "rustc-hash" version = "2.1.1" @@ -1445,6 +1470,51 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "rustls" +version = "0.23.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "758025cb5fccfd3bc2fd74708fd4682be41d99e5dff73c377c0646c6012c73a4" +dependencies = [ + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pki-types" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7df23109aa6c1567d1c575b9952556388da57401e4ace1d15f79eedad0d8f53" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "rustversion" version = "1.0.22" @@ -1734,6 +1804,12 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "syn" version = "2.0.117" @@ -1888,6 +1964,16 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + [[package]] name = "tokio-stream" version = "0.1.18" @@ -1919,9 +2005,14 @@ dependencies = [ "futures-util", "log", "native-tls", + "rustls", + "rustls-native-certs", + "rustls-pki-types", "tokio", "tokio-native-tls", + "tokio-rustls", "tungstenite 0.27.0", + "webpki-roots 0.26.11", ] [[package]] @@ -2136,6 +2227,8 @@ dependencies = [ "log", "native-tls", "rand", + "rustls", + "rustls-pki-types", "sha1", "thiserror", "utf-8", @@ -2182,6 +2275,12 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" version = "2.5.8" @@ -2378,6 +2477,24 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki-roots" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9" +dependencies = [ + "webpki-roots 1.0.6", +] + +[[package]] +name = "webpki-roots" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cfaf3c063993ff62e73cb4311efde4db1efb31ab78a3e5c457939ad5cc0bed" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "windows-core" version = "0.62.2" @@ -2437,6 +2554,15 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.59.0" @@ -2692,6 +2818,12 @@ dependencies = [ "synstructure", ] +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + [[package]] name = "zerotrie" version = "0.2.3" diff --git a/samod/Cargo.toml b/samod/Cargo.toml index 887e3f5..1a7d37f 100644 --- a/samod/Cargo.toml +++ b/samod/Cargo.toml @@ -10,7 +10,12 @@ repository = "https://github.com/alexjg/samod" [features] tokio = ["dep:tokio", "dep:tokio-util"] axum = ["dep:axum", "dep:tokio", "dep:tokio-util"] -tungstenite = ["dep:tungstenite", "dep:tokio-tungstenite", "tokio", "tungstenite/native-tls", "tokio-tungstenite/native-tls"] +tungstenite = ["dep:tungstenite", "dep:tokio-tungstenite", "tokio"] +# TLS backend selection for tungstenite-based dialing (`wss://`). +# Pick one explicitly in downstream crates. +tungstenite-native-tls = ["tungstenite", "tokio-tungstenite/native-tls"] +tungstenite-rustls-native-roots = ["tungstenite", "tokio-tungstenite/rustls-tls-native-roots"] +tungstenite-rustls-webpki-roots = ["tungstenite", "tokio-tungstenite/rustls-tls-webpki-roots"] gio = ["dep:gio", "dep:glib"] threadpool = ["dep:rayon"] diff --git a/samod/src/websocket.rs b/samod/src/websocket.rs index dcdb993..5accfc4 100644 --- a/samod/src/websocket.rs +++ b/samod/src/websocket.rs @@ -214,6 +214,9 @@ impl Repo { /// # Arguments /// /// * `url` - The WebSocket URL to connect to (e.g. `"wss://sync.example.com"`). + /// For `wss://` URLs, enable one TLS backend feature: + /// `tungstenite-native-tls`, `tungstenite-rustls-native-roots`, + /// or `tungstenite-rustls-webpki-roots`. /// * `backoff` - Backoff configuration for reconnection attempts. /// /// # Returns