Skip to content

fix(http): fall back to bundled Mozilla roots when the system CA store is empty - #2295

Merged
fengmk2 merged 8 commits into
mainfrom
http-webpki-roots-fallback
Aug 3, 2026
Merged

fix(http): fall back to bundled Mozilla roots when the system CA store is empty#2295
fengmk2 merged 8 commits into
mainfrom
http-webpki-roots-fallback

Conversation

@fengmk2

@fengmk2 fengmk2 commented Aug 2, 2026

Copy link
Copy Markdown
Member

When the shared HTTP client cannot be built because the trust store is
empty (Debian slim and distroless images ship no ca-certificates
package), retry once with the webpki-root-certs Mozilla list merged in,
like Node's own bundled roots. A populated system store keeps sole
authority; failures the bundle cannot fix still surface the original
error. Windows keeps native-tls/SChannel and skips the fallback.

Closes #2278


Stack created with GitHub Stacks CLIGive Feedback 💬

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Native binary sizes (976a82e)

Final release artifacts built by the canonical build-upstream and build-windows-cli actions.

Artifact Format Base PR Change
vp (Linux x64) Binary 10.38 MiB 10.51 MiB +132.02 KiB (+1.24%)
vp (Linux x64) gzip -9 4.45 MiB 4.55 MiB +98.23 KiB (+2.15%)
NAPI (Linux x64) Binary 33.48 MiB 33.60 MiB +128.06 KiB (+0.37%)
NAPI (Linux x64) gzip -9 12.93 MiB 13.02 MiB +97.95 KiB (+0.74%)
vp (macOS ARM64) Binary 7.70 MiB 7.83 MiB +129.02 KiB (+1.64%)
vp (macOS ARM64) gzip -9 3.86 MiB 3.95 MiB +96.28 KiB (+2.44%)
NAPI (macOS ARM64) Binary 40.79 MiB 40.92 MiB +129.00 KiB (+0.31%)
NAPI (macOS ARM64) gzip -9 17.15 MiB 17.24 MiB +93.31 KiB (+0.53%)
vp (Windows x64) Binary 8.42 MiB 8.42 MiB +512 B (+0.01%)
vp (Windows x64) gzip -9 3.66 MiB 3.66 MiB +223 B (+0.01%)
NAPI (Windows x64) Binary 27.76 MiB 27.76 MiB 0 B (0.00%)
NAPI (Windows x64) gzip -9 10.86 MiB 10.86 MiB +289 B (+0.00%)
Trampoline (Windows x64) Binary 203.00 KiB 203.00 KiB 0 B (0.00%)
Trampoline (Windows x64) gzip -9 97.91 KiB 97.91 KiB -1 B (-0.00%)
Installer (Windows x64) Binary 4.47 MiB 4.47 MiB +512 B (+0.01%)
Installer (Windows x64) gzip -9 2.09 MiB 2.09 MiB +164 B (+0.01%)

@fengmk2

fengmk2 commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 175538b184

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@fengmk2 fengmk2 added test: e2e Auto run e2e tests test: install-e2e run vite install e2e test test: create-e2e Run `vp create` e2e tests test: sfw preview-build Publish this PR's commits to the registry bridge as preview builds labels Aug 2, 2026
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Registry bridge build (175538b)

This commit build is published to the registry bridge, which serves these as ordinary npm versions (every other package proxies to npmjs):

Package Version
vite-plus 0.0.0-commit.175538b184911b9af6584b86bb2a9a7079b1ae25
@voidzero-dev/vite-plus-core 0.0.0-commit.175538b184911b9af6584b86bb2a9a7079b1ae25

Install the Vite+ CLI built from this commit, then migrate a project:

# macOS / Linux
curl -fsSL https://vite.plus | VP_PR_VERSION=2295 bash
# Windows (PowerShell)
$env:VP_PR_VERSION="2295"; irm https://vite.plus/ps1 | iex

After installing, upgrade the current project's vite-plus to this test build with:

vp migrate

Or point your package manager at the bridge registry https://registry-bridge.viteplus.dev/:

Package manager Registry config
npm / pnpm / Bun .npmrc: registry=https://registry-bridge.viteplus.dev/
Yarn (v2+) .yarnrc.yml: npmRegistryServer: "https://registry-bridge.viteplus.dev/"

Then pin the build (vite aliases to vite-plus-core; pnpm can use a catalog, npm an overrides entry):

{
  "devDependencies": {
    "vite-plus": "0.0.0-commit.175538b184911b9af6584b86bb2a9a7079b1ae25",
    "vite": "npm:@voidzero-dev/vite-plus-core@0.0.0-commit.175538b184911b9af6584b86bb2a9a7079b1ae25"
  }
}

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🐳 Docker preview image

Built from this PR's registry bridge build:

Image Compressed size
ghcr.io/voidzero-dev/vite-plus:pr-2295 240MB
# remove any stale local copy from a previous run, then pull fresh
docker rmi ghcr.io/voidzero-dev/vite-plus:pr-2295 2>/dev/null; docker pull ghcr.io/voidzero-dev/vite-plus:pr-2295

Quick check:

docker run --rm ghcr.io/voidzero-dev/vite-plus:pr-2295 vp --version

See docs/guide/docker.md for usage.

@fengmk2
fengmk2 marked this pull request as ready for review August 3, 2026 03:11
@fengmk2
fengmk2 force-pushed the http-webpki-roots-fallback branch from c78a484 to 6e68170 Compare August 3, 2026 03:12
@fengmk2
fengmk2 changed the base branch from docs/stacked-prs to main August 3, 2026 03:12
@netlify

netlify Bot commented Aug 3, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit 976a82e
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a70c047c69eab000801993a

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

✅ Staging deployment successful!

Preview: https://viteplus-staging.void.app/
Commit: 6e68170

@fengmk2

fengmk2 commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

Verified the registry-bridge build (175538b) in the original repro environment (node:24-bookworm-slim, no ca-certificates, packageManager: pnpm@10.27.0, cold cache):

  • vite-plus@0.2.7: vp fmt --check aborts with exit 134, "No CA certificates were loaded from the system"
  • this build: vp fmt --check runs oxfmt and reports format results normally, and the pinned pnpm is downloaded through vp's HTTP client into ~/.vite-plus/package_manager/pnpm/10.27.0/, confirming HTTPS works through the bundled Mozilla roots fallback

fengmk2 added 5 commits August 3, 2026 12:07
…e is empty

When the shared HTTP client cannot be built because the trust store is
empty (Debian slim and distroless images ship no ca-certificates
package), retry once with the webpki-root-certs Mozilla list merged in,
like Node's own bundled roots. A populated system store keeps sole
authority; failures the bundle cannot fix still surface the original
error. Windows keeps native-tls/SChannel and skips the fallback.

Closes #2278
On Windows native-tls rejects the invalid-DER PEM at parse time, so the
bad bundle is skipped with a warning, the build succeeds against
SChannel, and the is_err assertion fails. The bundled-roots retry the
test guards is compiled out on Windows anyway.
Regression test for the #2278 fallback: build the global vp inside a
bookworm container so its glibc floor matches the runtime image, then
run vp env list-remote in node:24-bookworm-slim, which ships no
ca-certificates package. The job asserts the CA bundle is really absent
so the check keeps guarding if the base image changes.
Both build-failure tests carried the same temp PEM write, env set/unset,
and cleanup scaffold; with_invalid_ssl_cert_file now owns it.
Mount the host rustup home so the container picks up the pinned nightly
that setup-rust installed instead of downloading it on every run;
rustup show still installs it if the mount misses.
@fengmk2
fengmk2 force-pushed the http-webpki-roots-fallback branch from 6e68170 to b0682df Compare August 3, 2026 04:07
@fengmk2
fengmk2 merged commit d1183bd into main Aug 3, 2026
104 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview-build Publish this PR's commits to the registry bridge as preview builds test: create-e2e Run `vp create` e2e tests test: e2e Auto run e2e tests test: install-e2e run vite install e2e test test: sfw

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fall back to bundled Mozilla roots when the system CA store is empty

2 participants