From 9a60c5e210761fcf83eb60ce4852e7f7c5aeef7e Mon Sep 17 00:00:00 2001 From: Aditi Date: Thu, 6 Mar 2025 23:39:59 +0530 Subject: [PATCH] src: suggest --use-system-ca when a certificate error occurs --- 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 86644cea76b6a3..b4c25fe2bcaa0f 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`