Description
📗 API Reference Docs Problem
- Version: v12.17.0
- Platform: macOS 10.14.6 Mojave: Darwin Kernel Version 18.7.0 x86_64
- Subsystem:
Location
HTTPS Module
Affected URL(s):
Problem description
The error "unable to verify the first certificate" with code UNABLE_TO_VERIFY_LEAF_SIGNATURE
is not documented making it extremely difficult to fix.
Turns out this was caused by a site not providing a certificate chain. While the error wasn't node's fault the lack of documentation made it look like a bug in node and made fixing the problem extremely difficult.
The true cause was obscured by work configuring certificate stores to explicitly trust the intermediate certificates so web browsers produced no errors. The vast majority of search results suggest disabling security (a terrible idea), the rest point out the NODE_EXTRA_CA_CERTS
which is helpful, but I was already using it.
Note: While this isn't actually a security vulnerability the fact that most advice is to turn off certificate verification it can lead people to introduce security vulnerabilities on their own.
Error: unable to verify the first certificate
at TLSSocket.onConnectSecure (_tls_wrap.js:1496:34)
at TLSSocket.emit (events.js:315:20)
at TLSSocket._finishInit (_tls_wrap.js:938:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:696:12) {
code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
}
- I would like to work on this issue and submit a pull request.