GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix: upgrade reqwest from 0.12 to 0.13 and rename the rustls-tls feature to rustls by Giorno-Giovana · Pull Request #1068 · voidzero-dev/vite-plus Conversation
|
✅ Deploy Preview for viteplus-preview canceled.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@Giorno-Giovana why close? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@fengmk2 looks like duplicate https://github.com/dwhoban/vite-plus/pull/1 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
But I think this could be merged anyway😁 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@codex review |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
macOS build fails |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
The macOS build fails because reqwest 0.13 with the rustls feature pulls in aws-lc-rs as the default crypto Fix: Switch from aws-lc-rs to ring as the crypto provider:
This completely removes aws-lc-sys from the dependency tree while keeping the same TLS behavior (platform |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem 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.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
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:
reqwest from 0.12 to 0.13 and update per-crate TLS feature flags (rustls-tls → rustls-no-provider on non-Windows).vite_shared::ensure_tls_provider() helper and call it before reqwest usage on non-Windows.rustls dependency (ring provider) and refresh Cargo.lock accordingly.Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.
| 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.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@Giorno-Giovana I'll take over and make some improvements |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
- 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.
There was an error while loading. Please reload this page.
## Problem
This surfaced while upgrading vite-plus from 0.1.21 to 0.2.6 in a CI
pipeline running on `node:24-bookworm-slim`: the lint and format jobs
started aborting with exit 134, having been green on 0.1.21 on the same
image.
The branch is two commits, so the bug can be inspected before the fix:
check out the first commit and run `cargo test -p vite_shared --lib
client_build_failure` to see the failure as a failing test, on an
otherwise unmodified tree. The second commit is an attempt at a fix.
`shared_http_client` panics whenever the client cannot be built, and
every input funnels into that one `panic!`: no system CA bundle, a
malformed proxy setting, an unusable TLS backend, an unparsable extra CA
bundle. Its doc comment states that a panic was chosen over
`process::exit` so that:
```
/// destructors of in-flight work still run (lockfiles released, tempfiles
/// cleaned) and an embedding Node host (NAPI) keeps the process alive.
```
`Cargo.toml` has, under `[profile.release]`:
```toml
panic = "abort" # Let it crash and force ourselves to write safe Rust.
```
`abort` does not unwind, so in every release build the panic delivers
neither property it was chosen for: lockfiles and temp dirs are not
cleaned, and SIGABRT takes the embedding Node host down with it. The
comment and the release profile have drifted apart, and every one of
those inputs becomes an unrecoverable abort, worst in exactly the
NAPI-embedded case the comment was written to protect.
The input that is near-universal in Debian-slim Node images is the
missing CA bundle: they ship no `ca-certificates` package, and Node
carries its own root list, so `node` and `npm` keep working and nothing
else reveals it. On such an image any direct `vp` subcommand aborts
instead of running:
```
Vite+ panicked. This is a bug in Vite+, not your code.
thread '<unnamed>' panicked at crates/vite_shared/src/http.rs:58:21:
failed to initialize HTTP client: builder error: unexpected error: No CA certificates were loaded from the system
Aborted (core dumped) # exit 134
```
Reproduces in about 30s with only Docker:
```bash
docker run --rm -w /app node:24-bookworm-slim sh -c '
echo "{\"name\":\"repro\",\"private\":true}" > package.json
npm i --silent [email protected]
echo "{\"name\":\"repro\",\"private\":true,\"packageManager\":\"[email protected]\"}" > package.json
./node_modules/.bin/vp fmt --check
echo "exit=$?"'
```
Holding image and project constant and varying only the vp version,
0.1.22 exits 1 with a handled error and 0.1.23 is the first release that
aborts, the release that shipped the shared client from #1686. The empty
trust store itself is not new (it has mattered since #1068 moved
verification onto the OS store to fix #1014); what changed is that it
became fatal.
Mechanism: `execute_direct_subcommand` calls
`envs_with_explicit_package_manager_path` for every direct subcommand.
With a `packageManager` field and a cold cache that downloads the pinned
package manager, which builds the shared client. Nothing here actually
needs the network, since the download failure is already handled and
falls back to the unmodified `PATH`, so with any single root certificate
present the same command completes normally even under `--network none`.
Without a `packageManager` field there is no download attempt and no
crash, which is why this only shows up on projects that pin one.
## Solution
`shared_http_client` now returns `Result<&Client, HttpClientError>`, and
the six call sites `?` it into the errors they already return. That
restores the behaviour the doc comment describes rather than adding a
new policy: callers already treat "no HTTP client" as a handled outcome,
they just never got the chance to. Every failure at that point is an
environment condition (no system CA bundle, an unusable proxy, an
unparsable extra CA bundle), so the message names the cause and the
remedy instead of asking for a bug report, which currently points away
from the fix.
The two artifacts cover different things, deliberately. The Docker
snippet above reproduces the reported symptom; the unit test pins the
branch. I could not reproduce the empty trust store portably in a unit
test, because macOS resolves roots through Security.framework and
`SSL_CERT_FILE` cannot empty the store there, so the test drives the
same `build()` failure branch through the documented `SSL_CERT_FILE`
contract, using a PEM block whose body is not valid DER. To check the
real condition I built the patched `vite_shared` in a Debian container
and deleted its CA store: it now returns the error and exits 0 instead
of aborting.
I only looked at this one call site, where the doc comment states the
intent explicitly, so I can't say whether the same drift between a
documented panic rationale and `panic = "abort"` exists anywhere else.
You may want to check.
### Note
The investigation and this patch were done with AI assistance, and my
own Rust is limited, so please scrutinise the implementation closely.
The diagnosis is empirically verified (bisected across releases,
reproduced in a container), but I have lower confidence in the patch
being the shape you would want. Happy to rework it however you prefer,
or to leave the diagnosis with you if you would rather fix it
yourselves.
---------
Co-authored-by: MK (fengmk2) <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
reqwest calls in vp fail when running behind a MITM proxy.
There was an error while loading. Please reload this page.