nodejs / nodejs/node

`tls.getCACertificates("default")` always returns an empty list when using `--use-openssl-ca`

Offen
#64,258 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

tls
Vorherrschende Sprache
JavaScript
Sterne
122k
Forks
37.3k
Ø Merge
4 T. 2 Std.
Gemergte PRs (30 T.)
283

Beschreibung

Version

v26.4.0

Platform
Linux jvm1 6.17.0-1025-oem #25-Ubuntu SMP PREEMPT_DYNAMIC Fri May 29 12:11:29 UTC 2026 x86_64 GNU/Linux
Subsystem

tls

What steps will reproduce the bug?
  1. Run NODE_OPTIONS="--use-openssl-ca" node -e 'console.log("Default certificates:", tls.getCACertificates("default")); fetch("https://example.org").then(rsp => console.log("HTTP status code:", rsp.status));'

Its output (provided your default OpenSSL certs are fairly standard) will be:

Default certificates: []
HTTP status code: 200

As can be seen, the request to https://example.org succeeds despite us having no default certificates according to tls.getCACertificates("default")

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

I would expect tls.getCACertificates("default") to return the certificates provided by OpenSSL that NodeJS uses to verify the certificate chain. I expect this since the documentation for the "default" type in tls.getCACertificates states: "return the CA certificates that will be used by the Node.js TLS clients by default".

What do you see instead?

An empty array

Additional information

Invoking tls.setDefaultCACertificates([]) and fetching https://example.org afterwards does cause UNABLE_TO_GET_ISSUER_CERT_LOCALLY

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, die gemeldete Reproduktion NODE_OPTIONS="--use-openssl-ca" auszuführen, und untersuche den Einstiegspunkt tls.getCACertificates("default") im tls-Subsystem. Vergleiche sein Ergebnis mit den von fetch verwendeten Zertifikaten und dem Verhalten nach tls.setDefaultCACertificates([]). Erledigt ist die Aufgabe, wenn die Standardliste die für die Verifizierung verwendeten OpenSSL-Zertifikate widerspiegelt und die Reproduktion durch Tests abgedeckt ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, linux, node.js
Bereich
backend, security
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
54/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.