You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: 'setCertificateVerifyProc()' is ignored when the HTTP request is sent from a 'utility' process using 'net.fetch()' on Windows and MacOS #44264
I agree to follow the Code of Conduct that this project adheres to.
I have searched the issue tracker for a bug report that matches the one I want to file, without success.
Electron Version
32.1.2
What operating system(s) are you using?
Other (specify below)
Operating System Version
MacOS Sonoma, Windows 11, Debian (Docker)
What arch are you using?
Other (specify below)
Last Known Working Electron version
No response
Expected Behavior
I have developed some tests to validate the behaviour of net.fetch() / fetch() on Windows, MacOS and Linux when sending HTTP(S) requests from the main process, from a renderer process and from a utility process. More specifically, I wanted to check the integration with the OS network settings and trust store when dealing with web proxies and self-signed certificates. See @hackolade/fetch for more details about my approach.
I expected net.fetch() / fetch() to behave consistently whatever the process and the operating system.
Actual Behavior
When using setCertificateVerifyProc() in order for net.fetch() / fetch() to consider valid a certificate authority file provided by the user (but not installed in the trust store of her/his OS), I observed the following:
On Linux, the certificate verification procedure that I set is invoked for all processes: main, renderer and utility. As a consequence, the application can reach the server that uses a self-signed certificate.
On MacOS and Windows, the certificate verification procedure that I set is not invoked for the utility process. As a consequence, the application fails to reach the server that uses a self-signed certificate from that process.
So how am I supposed to deal with that case?
Note that I created a separate issue for the problem with the 'login' event: see #44249.
@thomas-jakemeyn could you please create a standalone sample for this issue specifically? Linking your full fetch repo still requires we make assumptions and introduces extra margin for error in triage.
Hello @codebytere,
For reproducing this problem, you need more than just a Electron application. You also need to start a server that uses a self-signed certificate.
@thomas-jakemeyn In order to triage your issue we need a sample that only contains what is necessary to reproduce the issue. As mentioned above, this prevents other variables that can introduce error. Trimming down your repo to only these necessary parts would be extremely helpful.
I'm adding blocked/need-info for the above reason. Please add a link to a trimmed down sample in a follow-up comment.
As I said before, this problem is not something that you can reproduce with a simple code snippet. What I can do is extracting the instructions for you from the README file.
Steps to reproduce
Install the latest version of node: see instructions here.
Install and start the docker engine for your operating system: see instructions here.
Clone this repository.
Run npm install in this repository in order to install the dependencies.
Start the server with npm run docker:server.
Start the application with npm run test:app:custom-cert.
Expected behaviour
The application should render all connections - from main, renderer and utility - with a green background.
Actual behaviour
The background is red for the utility process on Windows and MacOS because the self-signed certificate is rejected although setCertificateVerifyProc() considers it valid.
@thomas-jakemeyn, while we appreciate that it's more involved than a simple code snippet, we need a more concise repro case than a full project that uses Docker and has many dependencies. We're not trying to be difficult, we just have a lot of issues to triage and prioritize those with a minimal repro case. If you can use Electron Fiddle to create a minimal repro case, we can try to further triage this issue.
If you start the application on MacOS or on Windows and if you look at the console logs, you will see the following:
>>> Fetching from main process was a SUCCESS
[3062:1118/154145.223346:ERROR:ssl_client_socket_impl.cc(878)] handshake failed; returned -1, SSL error code 1, net_error -202
>>> Fetching from utility process threw an ERROR Error: net::ERR_CERT_AUTHORITY_INVALID
at SimpleURLLoaderWrapper.<anonymous> (node:electron/js2c/utility_init:2:10511)
at SimpleURLLoaderWrapper.emit (node:events:519:28)
Reacted by David Babenko-Sanders, Ugo Bechameil, Pascal Desmarets and Keeley Hammond
Sends a request, similarly to how fetch() works in the renderer, using Chrome's network stack. This differs from Node's fetch(), which uses Node.js's HTTP stack.
This method will issue requests from the default session. To send a fetch request from another session, use ses.fetch().
So my understanding is that using setCertificateVerifyProc should work consistently in both the main process, a renderer process and a utility process as long as you use net.fetch.
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!
This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.
Activity
codebytere commentedon Oct 16, 2024
@thomas-jakemeyn could you please create a standalone sample for this issue specifically? Linking your full fetch repo still requires we make assumptions and introduces extra margin for error in triage.
thomas-jakemeyn commentedon Oct 16, 2024
Hello @codebytere,
For reproducing this problem, you need more than just a Electron application. You also need to start a server that uses a self-signed certificate.
That's exactly what my repository contains. It provides a containerised environment where you can easily reproduce the problem using those instructions: [APP] Test connection involving a self-signed certificate
mlaurencin commentedon Oct 31, 2024
@thomas-jakemeyn In order to triage your issue we need a sample that only contains what is necessary to reproduce the issue. As mentioned above, this prevents other variables that can introduce error. Trimming down your repo to only these necessary parts would be extremely helpful.
I'm adding
blocked/need-infofor the above reason. Please add a link to a trimmed down sample in a follow-up comment.thomas-jakemeyn commentedon Nov 15, 2024
As I said before, this problem is not something that you can reproduce with a simple code snippet. What I can do is extracting the instructions for you from the
READMEfile.Steps to reproduce
npm installin this repository in order to install the dependencies.npm run docker:server.npm run test:app:custom-cert.Expected behaviour
The application should render all connections - from
main,rendererandutility- with a green background.Actual behaviour
The background is red for the
utilityprocess on Windows and MacOS because the self-signed certificate is rejected althoughsetCertificateVerifyProc()considers it valid.dsanders11 commentedon Nov 16, 2024
@thomas-jakemeyn, while we appreciate that it's more involved than a simple code snippet, we need a more concise repro case than a full project that uses Docker and has many dependencies. We're not trying to be difficult, we just have a lot of issues to triage and prioritize those with a minimal repro case. If you can use Electron Fiddle to create a minimal repro case, we can try to further triage this issue.
thomas-jakemeyn commentedon Nov 18, 2024
Here is a small application that demonstrates the problem: https://gist.github.com/thomas-jakemeyn/663f6c648f42bb988aaeee9ba5a697b2.
session.defaultSession.setCertificateVerifyProc()to accept all certificates.net.fetch()to get https://self-signed.badssl.com/ from both the main process and a utility process.If you start the application on MacOS or on Windows and if you look at the console logs, you will see the following:
3 remaining items
alexdunae commentedon Mar 26, 2025
setCertificateVerifyProc() only applies to the Chromium window, it isn't used by Node API's likefetchandhttps.request.thomas-jakemeyn commentedon Mar 27, 2025
@alexdunae, this issue affects
net.fetch. This is what the Electron documentation says about it:And this is what that documentation says about setCertificateVerifyProc:
So my understanding is that using
setCertificateVerifyProcshould work consistently in both themainprocess, arendererprocess and autilityprocess as long as you usenet.fetch.alexdunae commentedon Mar 27, 2025
Thanks for clarifying @thomas-jakemeyn - I didn't realize that.
electron-issue-triage commentedon Jun 26, 2025
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!
thomas-jakemeyn commentedon Jun 26, 2025
This issue still happens with electron 37.1.0.
electron-issue-triage commentedon Sep 26, 2025
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!
thomas-jakemeyn commentedon Sep 26, 2025
bump
electron-issue-triage commentedon Dec 26, 2025
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!
electron-issue-triage commentedon Jan 25, 2026
This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.