mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-19 15:10:34 +01:00
12f79c0aeb
# Objective Fixes #63683 Behind a corporate TLS-inspecting proxy (e.g. Zscaler) whose root CA is installed in the OS trust store, the Zed Cloud websocket fails permanently with `invalid peer certificate: UnknownIssuer`, while every other connection in Zed works. `crates/cloud_api_client/src/websocket/native.rs` calls `yawc::WebSocket::connect` without a TLS connector. yawc's default connector trusts only the bundled `webpki-roots`, so it never consults the platform trust store. Everything else in Zed (the reqwest HTTP client and the collab websocket in `crates/client`) uses `http_client_tls::tls_config()`, which is built on `rustls-platform-verifier`. ## Solution Pass a `tokio_rustls::TlsConnector` built from `http_client_tls::tls_config()` to yawc via `WebSocketBuilder::with_connector`, so the cloud websocket verifies certificates exactly like the collab websocket does (`client_async_tls_with_connector_and_config(..., Some(Arc::new(http_client_tls::tls_config()).into()), ...)`). `cloud_api_client` gains two non-wasm dependencies: `http_client_tls` (workspace crate) and `tokio-rustls` (same `0.26` line yawc and `client` already use, no default features). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Ub1SNsrgWjTA6iAKanKfwt ## Testing - `cargo check -p cloud_api_client` and `cargo fmt --check` on macOS (arm64). - Reproduced the bug and validated the approach with a standalone rustls probe against `cloud.zed.dev` / `collab.zed.dev` from behind Zscaler: - `webpki_roots::TLS_SERVER_ROOTS` only (yawc's default): `InvalidCertificate(UnknownIssuer)` – identical to the error in the Zed log - `ClientConfig::with_platform_verifier()` (what `tls_config()` returns): connects fine - Reviewers behind a TLS-inspecting proxy can confirm by watching `~/Library/Logs/Zed/Zed.log` for `cloud websocket connect failed: invalid peer certificate: UnknownIssuer` before and after. - I could not test on Windows or Linux, but the change only routes the cloud websocket through the same `tls_config()` those platforms already use for all other HTTPS traffic. ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed the Zed Cloud connection failing with `UnknownIssuer` behind corporate TLS-inspecting proxies whose root CA is installed in the system trust store. --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Co-authored-by: Finn Evers <finn@zed.dev>
39 lines
1008 B
TOML
39 lines
1008 B
TOML
[package]
|
|
name = "cloud_api_client"
|
|
version = "0.1.0"
|
|
edition.workspace = true
|
|
publish.workspace = true
|
|
license = "Apache-2.0"
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[lib]
|
|
path = "src/cloud_api_client.rs"
|
|
doctest = false
|
|
|
|
[dependencies]
|
|
anyhow.workspace = true
|
|
cloud_api_types.workspace = true
|
|
futures-lite.workspace = true
|
|
futures.workspace = true
|
|
gpui.workspace = true
|
|
http_client.workspace = true
|
|
parking_lot.workspace = true
|
|
serde.workspace = true
|
|
serde_json.workspace = true
|
|
thiserror.workspace = true
|
|
yawc.workspace = true
|
|
|
|
[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
|
|
# Workspace inheritance would re-enable defaults, including blocking synchronization.
|
|
async-lock = { version = "3.4.2", default-features = false }
|
|
|
|
[target.'cfg(not(all(target_arch = "wasm32", target_os = "unknown")))'.dependencies]
|
|
async-lock.workspace = true
|
|
|
|
[target.'cfg(not(target_family = "wasm"))'.dependencies]
|
|
gpui_tokio.workspace = true
|
|
http_client_tls.workspace = true
|
|
tokio-rustls.workspace = true
|