From ca7d25f4327d353d940cb51b0e419d15df8b655b Mon Sep 17 00:00:00 2001 From: Alexander Weps Date: Mon, 22 Nov 2021 22:00:13 +0100 Subject: [PATCH] Fix notifications broken since Nativefier 43 / Electron 12 defaulting to contextIsolation:true (PR #1308) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copy-pastaing details from [Electron 12 breaking changes](https://www.electronjs.org/docs/latest/breaking-changes#planned-breaking-api-changes-120): > ### Default Changed: `contextIsolation` defaults to `true`[​](https://www.electronjs.org/docs/latest/breaking-changes#default-changed-contextisolation-defaults-to-true "Direct link to heading") > > In Electron 12, `contextIsolation` will be enabled by default. To restore the previous behavior, `contextIsolation: false` must be specified in WebPreferences. > > We [recommend having contextIsolation enabled](https://www.electronjs.org/docs/latest/tutorial/security#3-enable-context-isolation-for-remote-content) for the security of your application. > > Another implication is that `require()` cannot be used in the renderer process unless `nodeIntegration` is `true` and `contextIsolation` is `false`. > > For more details see: [https://github.com/electron/electron/issues/23506](https://github.com/electron/electron/issues/23506) I find the security drop acceptable, as reverting the new Electron 12 isolation brings us to the previous level of security, and I don't have the time/will to keep the isolation and migrate to the newer better safer thing that Electron >= 12 wants. Co-authored-by: Radomír Polách --- app/src/helpers/windowHelpers.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/helpers/windowHelpers.ts b/app/src/helpers/windowHelpers.ts index f010486..0114a2d 100644 --- a/app/src/helpers/windowHelpers.ts +++ b/app/src/helpers/windowHelpers.ts @@ -148,6 +148,7 @@ export function getDefaultWindowOptions( plugins: true, webSecurity: !options.insecure, zoomFactor: options.zoom, + contextIsolation: false, ...webPreferences, }, ...browserwindowOptions,