Skip to content

Conversation

@javierlarota
Copy link

@javierlarota javierlarota commented Nov 26, 2021

The Electron app fails when using a self-signed certificate for https communications with its ASP.NET Core backend. The native electron framework allows to ignore or bypass certificate errors. I am exposing this feature to Electron.NET

There will be two ways to bypass certificate errors:

  1. By adding this flag to the electron.manifest.json file: "ignoreAllCertificateErrors": true it will allow to ignore all cert errors. This option is less secure

  2. By adding a list of domain names that we want to ignore certificate errors for in the electron.manifest.json file:

  "domainNamesToIgnoreCertificateErrors": [
    "localhost",
    "127.0.0.1",
    "www.insecure.site.com"
  ],

… certificate for https communication with the AspCore backend.

We can ignore all cert errors or only cert errors from specific domain names configured in electron.manifest.json
// Bypass SSL/TLS certificate errors only for the domain names specified in the electron.manifest.json file.
if (manifestJsonFile.hasOwnProperty('domainNamesToIgnoreCertificateErrors')) {
if (manifestJsonFile.domainNamesToIgnoreCertificateErrors.length > 0) {
manifestJsonFile.domainNamesToIgnoreCertificateErrors.forEach(function (site) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be reduced to a single log file

console.log(`SSL/TLS certificate errors will be ignored for ${manifestJsonFile.domainNamesToIgnoreCertificateErrors.join(', ')}`);

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I made the change. Thanks

@GregorBiswanger GregorBiswanger self-assigned this Apr 6, 2022
@GregorBiswanger GregorBiswanger added this to the 18.6.1 milestone Apr 6, 2022
@GregorBiswanger GregorBiswanger merged commit 4afa535 into ElectronNET:master Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants