Skip to content

fix: upgrade reqwest from 0.12 to 0.13 and rename the rustls-tls feature to rustls#1068

Merged
fengmk2 merged 11 commits intovoidzero-dev:mainfrom
Giorno-Giovana:main
Mar 25, 2026
Merged

fix: upgrade reqwest from 0.12 to 0.13 and rename the rustls-tls feature to rustls#1068
fengmk2 merged 11 commits intovoidzero-dev:mainfrom
Giorno-Giovana:main

Conversation

@Giorno-Giovana
Copy link
Contributor

@Giorno-Giovana Giorno-Giovana commented Mar 20, 2026

closes #1014

Motivation

vp install fails on macOS with a TLS error when trying to download the Node.js runtime from nodejs.org:

error: Failed to download Node.js runtime: Failed to download from
https://nodejs.org/dist/v22.18.0/SHASUMS256.txt: error sending request for url

The root cause is how reqwest 0.12 handles TLS certificate verification on non-Windows platforms. With the
rustls-tls feature, it uses webpki-roots — a hardcoded bundle of Mozilla root certificates compiled into the
binary. If the server's certificate chain involves a CA not present in that bundle (or the bundle is
outdated), TLS verification fails, even though the system's certificate store (macOS Keychain) trusts the
certificate.

reqwest 0.13 replaces the rustls-tls feature with rustls, which uses rustls-platform-verifier instead of
webpki-roots. This verifier delegates certificate validation to the OS-native certificate store
(Security.framework on macOS, SChannel on Windows), matching the behavior of curl and other system tools.

@netlify
Copy link

netlify bot commented Mar 20, 2026

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit 866643b
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/69c3488bccaf1e00083c5498

@Giorno-Giovana Giorno-Giovana changed the title Up reqwest version Upgrade reqwest from 0.12 to 0.13 and rename the rustls-tls feature to rustls (the new name in 0.13) Mar 20, 2026
@fengmk2
Copy link
Member

fengmk2 commented Mar 20, 2026

@Giorno-Giovana why close?

@Giorno-Giovana
Copy link
Contributor Author

@fengmk2 looks like duplicate dwhoban#1

@Giorno-Giovana
Copy link
Contributor Author

But I think this could be merged anyway😁

@fengmk2
Copy link
Member

fengmk2 commented Mar 21, 2026

@codex review

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@fengmk2 fengmk2 changed the title Upgrade reqwest from 0.12 to 0.13 and rename the rustls-tls feature to rustls (the new name in 0.13) fix: upgrade reqwest from 0.12 to 0.13 and rename the rustls-tls feature to rustls Mar 21, 2026
Copy link
Member

@fengmk2 fengmk2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, I will release a test version to verify before I merge.

@fengmk2
Copy link
Member

fengmk2 commented Mar 21, 2026

macOS build fails

@Giorno-Giovana
Copy link
Contributor Author

The macOS build fails because reqwest 0.13 with the rustls feature pulls in aws-lc-rs as the default crypto
provider.

Fix: Switch from aws-lc-rs to ring as the crypto provider:

  1. Changed reqwest feature from rustls to rustls-no-provider (avoids pulling in aws-lc-sys)
  2. Added rustls as a workspace dependency with ring feature enabled
  3. Added ensure_tls_provider() calls that install the ring crypto provider at runtime (using OnceLock for
    one-time initialization)

This completely removes aws-lc-sys from the dependency tree while keeping the same TLS behavior (platform
certificate verification via rustls-platform-verifier).

@Giorno-Giovana Giorno-Giovana requested a review from fengmk2 March 23, 2026 09:39
Copy link
Member

@fengmk2 fengmk2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Giorno-Giovana Thanks a lot! I will merge after manual verification passes.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR upgrades the workspace to reqwest 0.13 and adjusts TLS configuration on non-Windows platforms so HTTPS requests use OS-native certificate verification (via rustls-platform-verifier), addressing TLS failures behind MITM proxies / certain macOS trust-chain scenarios.

Changes:

  • Bump workspace reqwest from 0.12 to 0.13 and update per-crate TLS feature flags (rustls-tlsrustls-no-provider on non-Windows).
  • Add a shared vite_shared::ensure_tls_provider() helper and call it before reqwest usage on non-Windows.
  • Add workspace rustls dependency (ring provider) and refresh Cargo.lock accordingly.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/vite_shared/src/tls.rs New helper to install a rustls crypto provider on non-Windows.
crates/vite_shared/src/lib.rs Exposes ensure_tls_provider from vite_shared.
crates/vite_shared/Cargo.toml Adds non-Windows dependency on rustls.
crates/vite_js_runtime/src/download.rs Ensures TLS provider is installed before making reqwest requests.
crates/vite_js_runtime/Cargo.toml Switches non-Windows reqwest feature to rustls-no-provider.
crates/vite_install/src/request.rs Ensures TLS provider is installed before making reqwest requests.
crates/vite_install/Cargo.toml Switches non-Windows reqwest feature to rustls-no-provider.
crates/vite_error/Cargo.toml Switches non-Windows reqwest feature to rustls-no-provider.
Cargo.toml Upgrades workspace reqwest to 0.13 and adds workspace rustls dependency.
Cargo.lock Lockfile updates for reqwest 0.13 + new TLS dependency graph.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fengmk2
Copy link
Member

fengmk2 commented Mar 25, 2026

@Giorno-Giovana I'll take over and make some improvements

fengmk2 added 6 commits March 25, 2026 09:56
- Document ca-certificates as required on Alpine for TLS verification
- Add CI negative test proving install.sh fails without ca-certificates
- Add comment explaining silent error ignore in TLS provider init
- Ignore flaky SHA224 test on musl (same race condition as SHA1 test)
The negative test now removes /etc/ssl/certs/ca-certificates.crt after
vp is installed, then verifies that vp HTTPS calls fail. This proves
rustls-platform-verifier requires OS root CAs.

The previous approach (skipping ca-certificates in apk add) didn't work
because curl transitively pulls in ca-certificates-bundle.
Move the TLS negative test from test-standalone-install.yml to the
"Run E2E in Alpine container" step in ci.yml, which is the proper
place to test vp runtime behavior on Alpine.
The fallback to bundled root certs will make this test unnecessary.
ca-certificates is not a user requirement since the TLS stack will
fall back to bundled Mozilla root certificates when the system cert
store is empty.
@fengmk2 fengmk2 merged commit 2ce7af3 into voidzero-dev:main Mar 25, 2026
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

reqwest calls in vp fail when running behind a MITM proxy.

3 participants