-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggest --use-system-ca when a certificate error occurs #57362
base: main
Are you sure you want to change the base?
Conversation
Review requested:
|
4ef5477
to
e9b2b8f
Compare
Linter is complaining
|
3847336
to
f023b3e
Compare
doc/api/tls.md
Outdated
@@ -547,6 +547,12 @@ description are taken from deps/openssl/openssl/crypto/x509/x509_txt.c | |||
* `'CERT_REJECTED'`: Certificate rejected. | |||
* `'HOSTNAME_MISMATCH'`: Hostname mismatch. | |||
|
|||
Note: When certificate errors like `UNABLE_TO_VERIFY_LEAF_SIGNATURE`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: When certificate errors like `UNABLE_TO_VERIFY_LEAF_SIGNATURE`, | |
When certificate errors like `UNABLE_TO_VERIFY_LEAF_SIGNATURE`, |
src/crypto/crypto_common.cc
Outdated
if (suggest_system_ca) | ||
reason.append("; if the root CA is installed locally, " | ||
"try running Node.js with --use-system-ca"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (suggest_system_ca) | |
reason.append("; if the root CA is installed locally, " | |
"try running Node.js with --use-system-ca"); | |
if (suggest_system_ca) { | |
reason.append("; if the root CA is installed locally, " | |
"try running Node.js with --use-system-ca"); | |
} |
await assert.rejects(makeRequest(port, 3), (err) => { | ||
assert.strictEqual(err.code, 'DEPTH_ZERO_SELF_SIGNED_CERT'); | ||
return true; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await assert.rejects(makeRequest(port, 3), (err) => { | |
assert.strictEqual(err.code, 'DEPTH_ZERO_SELF_SIGNED_CERT'); | |
return true; | |
}); | |
await assert.rejects(makeRequest(port, 3), { | |
code: 'DEPTH_ZERO_SELF_SIGNED_CERT', | |
}); |
await assert.rejects(makeRequest(port, 3), (err) => { | ||
assert.strictEqual(err.code, 'DEPTH_ZERO_SELF_SIGNED_CERT'); | ||
return true; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await assert.rejects(makeRequest(port, 3), (err) => { | |
assert.strictEqual(err.code, 'DEPTH_ZERO_SELF_SIGNED_CERT'); | |
return true; | |
}); | |
await assert.rejects(makeRequest(port, 3), { | |
code: 'DEPTH_ZERO_SELF_SIGNED_CERT', | |
}); |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #57362 +/- ##
==========================================
- Coverage 90.21% 90.21% -0.01%
==========================================
Files 630 630
Lines 185304 185315 +11
Branches 36266 36276 +10
==========================================
+ Hits 167171 167178 +7
- Misses 11084 11086 +2
- Partials 7049 7051 +2
🚀 New features to boost your workflow:
|
f023b3e
to
9a60c5e
Compare
This change appends a hint suggesting that if the root CA is installed locally, try running with the --use-system-ca flag.
For errors like
UNABLE_TO_VERIFY_LEAF_SIGNATURE
,DEPTH_ZERO_SELF_SIGNED_CERT
, orUNABLE_TO_GET_ISSUER_CERT
occur.This change directs developers toward a secure solution — preventing them from using unsafe workarounds (e.g. disabling TLS verification entirely) that have been discussed in the threads online like the following:
Thanks @joyeecheung for the help :)