Skip to content

[Bug]: 'setCertificateVerifyProc()' is ignored when the HTTP request is sent from a 'utility' process using 'net.fetch()' on Windows and MacOS #44264

Closed as not planned

Description

@thomas-jakemeyn

Preflight Checklist

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?

Image

Note that I created a separate issue for the problem with the 'login' event: see #44249.

Testcase Gist URL

https://gist.github.com/thomas-jakemeyn/663f6c648f42bb988aaeee9ba5a697b2

https://github.com/hackolade/fetch/tree/develop

Additional Information

No response

Activity

  1. codebytere commented on Oct 16, 2024

    @codebytere
    Member

    @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.

  2. added
    blocked/need-info ❌
    on Oct 16, 2024
  3. thomas-jakemeyn commented on Oct 16, 2024

    @thomas-jakemeyn
    Author

    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

  4. removed
    blocked/need-info ❌
    on Oct 16, 2024
  5. mlaurencin commented on Oct 31, 2024

    @mlaurencin
    Member

    @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.

  6. added
    blocked/need-info ❌
    on Oct 31, 2024
  7. thomas-jakemeyn commented on Nov 15, 2024

    @thomas-jakemeyn
    Author

    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.

  8. removed
    blocked/need-info ❌
    on Nov 15, 2024
  9. dsanders11 commented on Nov 16, 2024

    @dsanders11
    Member

    @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.

  10. added
    blocked/need-info ❌
    on Nov 16, 2024
  11. thomas-jakemeyn commented on Nov 18, 2024

    @thomas-jakemeyn
    Author

    Here is a small application that demonstrates the problem: https://gist.github.com/thomas-jakemeyn/663f6c648f42bb988aaeee9ba5a697b2.

    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)
    
  12. 3 remaining items

  13. alexdunae commented on Mar 26, 2025

    @alexdunae

    setCertificateVerifyProc() only applies to the Chromium window, it isn't used by Node API's like fetch and https.request.

  14. thomas-jakemeyn commented on Mar 27, 2025

    @thomas-jakemeyn
    Author

    @alexdunae, this issue affects net.fetch. This is what the Electron documentation says about it:

    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().

    And this is what that documentation says about setCertificateVerifyProc:

    Sets the certificate verify proc for session.

    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.

  15. alexdunae commented on Mar 27, 2025

    @alexdunae

    Thanks for clarifying @thomas-jakemeyn - I didn't realize that.

  16. electron-issue-triage commented on Jun 26, 2025

    @electron-issue-triage

    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!

  17. thomas-jakemeyn commented on Jun 26, 2025

    @thomas-jakemeyn
    Author

    This issue still happens with electron 37.1.0.

  18. electron-issue-triage commented on Sep 26, 2025

    @electron-issue-triage

    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!

  19. thomas-jakemeyn commented on Sep 26, 2025

    @thomas-jakemeyn
    Author

    bump

  20. electron-issue-triage commented on Dec 26, 2025

    @electron-issue-triage

    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!

  21. electron-issue-triage commented on Jan 25, 2026

    @electron-issue-triage

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    32-x-ybug 🪲component/netcomponent/utilityProcesshas-repro-giststale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions