From d615a3cfcbc357ccebd07a37fa0002fee162d9ce Mon Sep 17 00:00:00 2001 From: Aditi <62544124+Aditi-1400@users.noreply.github.com> Date: Wed, 12 Mar 2025 18:51:22 +0530 Subject: [PATCH] src: suggest --use-system-ca when a certificate error occurs PR-URL: https://github.com/nodejs/node/pull/57362 Reviewed-By: Yagiz Nizipli Reviewed-By: Joyee Cheung --- doc/api/tls.md | 6 ++++++ src/crypto/crypto_common.cc | 14 +++++++++++++- .../parallel/test-https-agent-create-connection.js | 6 +++--- test/parallel/test-tls-addca.js | 2 +- test/parallel/test-tls-friendly-error-message.js | 1 - test/parallel/test-tls-set-secure-context.js | 12 ++++++------ test/parallel/test-tls-socket-default-options.js | 10 +++++----- 7 files changed, 34 insertions(+), 17 deletions(-) diff --git a/doc/api/tls.md b/doc/api/tls.md index cda3c2001d3..fc82f634f73 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -547,6 +547,12 @@ description are taken from deps/openssl/openssl/crypto/x509/x509_txt.c * `'CERT_REJECTED'`: Certificate rejected. * `'HOSTNAME_MISMATCH'`: Hostname mismatch. +When certificate errors like `UNABLE_TO_VERIFY_LEAF_SIGNATURE`, +`DEPTH_ZERO_SELF_SIGNED_CERT`, or `UNABLE_TO_GET_ISSUER_CERT` occur, Node.js +appends a hint suggesting that if the root CA is installed locally, +try running with the `--use-system-ca` flag to direct developers towards a +secure solution, to prevent unsafe workarounds. + ## Class: `tls.CryptoStream`