Skip to content

node, node-lts: trust the system CA store by default (--openssl-use-def-ca-store) - #1133

Merged
bryan-minimal merged 1 commit into
mainfrom
sysca-node-system-ca
Oct 30, 2026
Merged

bryan-minimal merged 1 commit into
mainfrom
sysca-node-system-ca

Conversation

@bryan-minimal

Copy link
Copy Markdown
Member

Part of gominimal/pkgmgr-rs#1026 (prefer the system trust store; follow-up to CVE-2026-111943, eMudhra).

What

node and node-lts now trust the system CA store (/etc/ssl, from ca-certificates) instead of the Mozilla roots compiled into node. A CA removed from ca-certificates then stops being trusted without a node rebuild.

  • ./configure --openssl-use-def-ca-store. It defines NODE_OPENSSL_CERT_STORE, which makes --use-openssl-ca the default (configure.py and src/node_options.h at v26.12.1 / v24.22.1). In that mode NewRootCertStore() (src/crypto/crypto_context.cc) calls X509_STORE_set_default_paths() in place of adding the bundled roots, so the store is replaced, not extended. --use-system-ca (and NODE_USE_SYSTEM_CA) would only add the system roots to the bundled ones, so a distrust would never take effect.
  • Our openssl is built with --openssldir=/etc/ssl, so the default paths are /etc/ssl/cert.pem + /etc/ssl/certs, both shipped by ca-certificates. ca-certificates is now a runtime dep; without it node would trust nothing.
  • build.sh fails if the built node's --help doesn't mark the OpenSSL store as (default).

Opt-out and semantics

  • --use-bundled-ca, on the command line or in NODE_OPTIONS (kAllowedInEnvvar), restores the compiled-in store.
  • NODE_EXTRA_CA_CERTS still adds to whichever store is in use.
  • SSL_CERT_FILE / SSL_CERT_DIR override the default paths, as in OpenSSL.
  • --use-system-ca is accepted but does nothing in this mode.
  • tls.rootCertificates is still the bundled list, so the existing emsign_roots_removed test still checks it. tls.getCACertificates('default') also still lists the bundled roots, because lib/tls.js keys that list on the --use-openssl-ca flag rather than on the store actually in use. That only affects what the API reports; connections use the OpenSSL store.

Test

system_ca_store_default (standalone, offline):

  • A local server presents a leaf from a throwaway test CA named only by SSL_CERT_FILE. Node must trust it by default. Stock node never reads SSL_CERT_FILE, so this fails without the flag (negative control).
  • With --use-bundled-ca, and again with NODE_OPTIONS=--use-bundled-ca, the same leaf must be rejected (UNABLE_TO_*).
  • NODE_EXTRA_CA_CERTS must still be honoured on top of the bundled store.

🤖 Generated with Claude Code

Configure with --openssl-use-def-ca-store, which defines
NODE_OPENSSL_CERT_STORE and makes `--use-openssl-ca` the default
(configure.py / src/node_options.h at v26.12.1 and v24.22.1). In that
mode NewRootCertStore() loads OpenSSL's default paths INSTEAD of the
compiled-in Mozilla roots, so a CA removed from ca-certificates
(CVE-2026-111943, eMudhra) stops being trusted without a node rebuild.
Our openssl uses --openssldir=/etc/ssl, so that is /etc/ssl/cert.pem and
/etc/ssl/certs; ca-certificates becomes a runtime dep.

Opt-out: --use-bundled-ca, on the command line or in NODE_OPTIONS.
NODE_EXTRA_CA_CERTS still adds to either store.

build.sh fails if the built node's --help does not mark the OpenSSL
store as the default. New standalone test system_ca_store_default: a
local server with a throwaway test CA named only by SSL_CERT_FILE must
be trusted by default (stock node never reads SSL_CERT_FILE, so it
fails there), and not with --use-bundled-ca / NODE_OPTIONS; plus
NODE_EXTRA_CA_CERTS on top of the bundled store.

Refs gominimal/pkgmgr-rs#1026.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bryan-minimal
bryan-minimal requested a review from a team as a code owner October 27, 2026 20:56
@coderabbitai

coderabbitai Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

  • Run on-demand review

This review includes 4 billable files and costs up to $1.00.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 25 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 66 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 756166c and 4fd3627.

Files selected for processing: 4
  • packages/node-lts/build.ncl
  • packages/node-lts/build.sh
  • packages/node/build.ncl
  • packages/node/build.sh
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@mitodrummer mitodrummer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

--openssl-use-def-ca-store defines NODE_OPENSSL_CERT_STORE, and node's NewRootCertStore() then calls X509_STORE_set_default_paths() instead of adding the bundled roots, so the store is replaced rather than extended. The build fails if --help does not mark the OpenSSL store as default. The test shows a CA named only by SSL_CERT_FILE is trusted by default (stock node ignores SSL_CERT_FILE) and rejected under --use-bundled-ca, and it passes for node and node-lts on both arches. ca-certificates is declared at runtime, so every ca-certificates bundle update will now rebuild node, node-lts and everything that depends on them.

@bryan-minimal
bryan-minimal added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit 8d105a3 Oct 30, 2026
12 checks passed
@bryan-minimal
bryan-minimal deleted the sysca-node-system-ca branch October 30, 2026 17:48
bryan-minimal added a commit that referenced this pull request Nov 2, 2026
…A store, #1133)

#1133 (node, node-lts: trust the system CA store by default) conflicted
with this branch only in the import block of node{,-lts}/build.ncl: both
sides added imports after `gcc`. Kept both: this branch's llvm, wasi-libc,
llhttp-wasm-rebuild and amaro-wasm, and main's ca-certificates.

Everything else auto-merged and is kept from both sides:
- main's ca-certificates runtime dep, the --openssl-use-def-ca-store
  configure flag, the post-install `node --help` guard and the
  system_ca_store_default test;
- this branch's wasm pins, splices, both censuses, smoke and type_strip.
The CA change touches only configure flags and runtime deps, so neither
census nor any splice is affected. No node, node-lts or next version moved
on main since the last merge (fdb5524), so the undici / llhttp / amaro
pins are unchanged.

Checked: nickel format --check and bash -n on node{,-lts}; mip dump
--packages evaluates on amd64 (651 packages) and arm64 (649), with
ca-certificates and the wasm build deps both present on node and node-lts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bryan-minimal added a commit that referenced this pull request Nov 2, 2026
…t (review)

The patched PREK_NATIVE_TLS default reads /etc/ssl/certs/ca-certificates.crt,
so the store has to be in prek's closure, as #1130/#1133/#1134/#1135 do.
Without it a session with prek and no store silently uses the compiled-in
roots. ca-certificates leaves system_ca_default's test_deps (base and git do
not bring it), so the test's `test -s` line now proves the runtime edge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants