fix(deps): use native OS certificate store for TLS on non-Windows platforms#1134
Closed
Jkker wants to merge 1 commit intovoidzero-dev:mainfrom
Closed
fix(deps): use native OS certificate store for TLS on non-Windows platforms#1134Jkker wants to merge 1 commit intovoidzero-dev:mainfrom
Jkker wants to merge 1 commit intovoidzero-dev:mainfrom
Conversation
…tforms Switch reqwest feature from `rustls-tls` to `rustls-tls-native-roots` in vite_error, vite_install, and vite_js_runtime crates. `rustls-tls` bundles Mozilla's root CA store (webpki-roots) at compile time. This means the `vp` binary can only verify certificates signed by CAs in Mozilla's root program, ignoring any additional CAs installed in the OS certificate store. `rustls-tls-native-roots` uses `rustls-native-certs` to load certificates from the platform's native trust store at runtime: - macOS: Security.framework (System Keychain) - Linux: OpenSSL certificate directories - Windows: unchanged (already uses native-tls-vendored / SChannel) This fixes TLS verification failures for users behind corporate proxies, firewalls, or TLS inspection appliances that re-sign certificates with a private Switch reqwest feature from `rustls-tls` to `rustls-tls-native-roots` in vite_error, vite_install, and vite_js_runtime crates. `rustls-tls` bundles Mozilla's root CA store (webpki-roots) git reset HEAD 2>&1 git --no-pager log --oneline -3 git --no-pager log --oneline -3 2>&1 | head -5 git --no-pager status --short 2>&1 | tail -10 exit export PATH="/opt/homebrew/opt/rustup/bin:$PATH" && git status --short 2>&1 | head -10
✅ Deploy Preview for viteplus-preview canceled.
|
Member
|
This is a duplicate of #1068 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
vpbinary fails all HTTPS requests (downloads, registry lookups, upgrade checks) when running behind a TLS-intercepting proxy or firewall that re-signs certificates with a private CA.Root cause: On non-Windows platforms, reqwest is configured with the
rustls-tlsfeature, which bundles Mozilla's root CA store (webpki-roots) at compile time. This hardcoded CA set ignores any additional certificates installed in the operating system's trust store. When a network appliance re-signs TLS certificates with a private CA (common in corporate and enterprise environments),vpcannot verify any HTTPS connection.Fix: Switch from
rustls-tlstorustls-tls-native-rootsin the three crates that depend on reqwest (vite_error,vite_install,vite_js_runtime). This replaceswebpki-rootswithrustls-native-certs, which loads certificates from the platform's native trust store at runtime:/etc/ssl/certs, etc.)native-tls-vendored(SChannel)Switching from
rustls-tlstorustls-tls-native-rootsrustls-tlsrustls-tls-native-rootssecurity-framework(macOS),openssl-probe(Linux)The underlying TLS library (rustls) and cryptographic backend remain identical — only the source of trusted root certificates changes.
Reproduction
vpon any machine where HTTPS traffic is intercepted by a TLS proxy that re-signs certificates with a non-Mozilla CAcurl,node,git, and other tools that use the OS certificate store or respectSSL_CERT_FILEVerify the issue in the binary
Changes
crates/vite_error/Cargo.toml:rustls-tls→rustls-tls-native-rootscrates/vite_install/Cargo.toml:rustls-tls→rustls-tls-native-rootscrates/vite_js_runtime/Cargo.toml:rustls-tls→rustls-tls-native-rootsCargo.lock: replaceswebpki-rootswithrustls-native-certs(+ transitive depssecurity-framework,openssl-probe)No Rust source code changes required.