Repository navigation
Description
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Problem Description
We use Electron to build a browser that displays its own certificate warning page. When a navigation fails because the certificate issuer is unknown, we want to explain the error and offer a “Continue” action only when policy permits it. For example, a user visiting a host with an active HTTP Strict Transport Security (HSTS) policy should only see actions that take them back to safety.
The certificate-error event gives the application the URL, error code, certificate, and isMainFrame. Two hosts can present the same certificate and produce the same error code while Chromium applies strict enforcement to only one of them. The JavaScript handler has no documented way to read that decision for the failing navigation. Electron certificate-error documentation
Proposed Solution
Expose the strict_enforcement value that Chromium already supplies to Electron as a read-only boolean on both the app and webContents versions of certificate-error. One possible API shape is a trailing strictEnforcement argument after isMainFrame, which existing listeners could ignore.
The distinction matters for the API documentation. A value of true tells the application to suppress any action that would let the user proceed. A value of false leaves the application responsible for evaluating the specific certificate error and its own policy. The requested change only exposes information about the current failure. Electron’s native event implementation
Alternatives Considered
- Classify by error code.
ERR_CERT_AUTHORITY_INVALIDoccurs both with and without HSTS. A lookup table cannot distinguish those cases. - Check HSTS separately. Observing an HSTS upgrade can confirm one reason to suppress “Continue.” The absence of an observed upgrade does not establish that Chromium permits an exception for the original HTTPS navigation.
- Always hide “Continue.” This is safe, but also removes the option for failures that Chromium and the application’s policy would otherwise allow a user to accept.
Additional Information
We tested Electron 45.4.1 with Chromium 156.0.8078.100 on macOS arm64. We navigated the main frame to three local test hosts serving the same certificate from an untrusted issuer. One host had no configured HSTS rule, one had a stored rule, and one was covered by the preload list. We independently confirmed that Chromium applied HSTS to the latter two.
All three navigations emitted ERR_CERT_AUTHORITY_INVALID with the same certificate fingerprint and isMainFrame === true. The handler rejected every failure. The HTTPS server received zero HTTP requests.
A useful regression test would exercise the ordinary host and an HSTS host with the same certificate error, then assert that both event variants expose Chromium’s corresponding strictEnforcement value. This would give applications a reliable input for their warning UI while keeping Chromium responsible for determining strict enforcement.
Activity
github-actions commentedon Nov 24, 2026
Hello @siberian-neuro. Thanks for taking the time to open an issue and helping to make Electron better!
This issue was automatically closed because its body does not follow any of this repository's issue templates. Maintainers rely on the sections in those templates to triage issues, and issues that are missing them usually cannot be acted upon.
To get this issue triaged, please either: