electron: [Bug]: Unable to verify leaf signature with TLS connection

Preflight Checklist

Electron Version

v25.0.0

What operating system are you using?

Windows

Operating System Version

Windows 10 19045.2965

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

Using a self-signed certificate to create a TLS connection with a custom CA when running Electron as NodeJS successfully performs the request without error.

Actual Behavior

The request fails with the following stacktrace:

Error: unable to verify the first certificate
    at TLSSocket.onConnectSecure (node:_tls_wrap:1540:34)
    at TLSSocket.emit (node:events:513:28)
    at TLSSocket._finishInit (node:_tls_wrap:959:8)
    at ssl.onhandshakedone (node:_tls_wrap:743:12) {
  code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE

Testcase Gist URL

https://gist.github.com/kylecarbs/3eeb7d35a5fd6d9828e675f467144947

Additional Information

Reproduction:

  1. Run server.js in a background terminal
  2. Run node client.js and observe Working! being output.
  3. Run ELECTRON_RUN_AS_NODE=1 electron.exe client.js and observe the error.

It’s possible I’m missing something obvious here. I’ve reproduced this on Linux and Windows.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (2 by maintainers)

Most upvoted comments

I can confirm the findings mentioned in https://github.com/electron/electron/issues/38527#issuecomment-1626220389. Removing the keyUsage would solve the issue.

@code-asher Thanks for investigating!

Is there any hope, that this bug will be solved?