Skip to main content

no-electron-allow-running-insecure-content

Disallow enabling Electron webPreferences.allowRunningInsecureContent.

Targeted pattern scopeโ€‹

This rule targets Electron BrowserWindow and BrowserView constructor options that set webPreferences.allowRunningInsecureContent to true.

What this rule reportsโ€‹

This rule reports webPreferences.allowRunningInsecureContent: true in Electron renderer configuration objects.

Why this rule existsโ€‹

Allowing insecure content weakens transport guarantees and allows mixed-content execution in renderer processes.

โŒ Incorrectโ€‹

new BrowserWindow({
webPreferences: {
allowRunningInsecureContent: true,
},
});

โœ… Correctโ€‹

new BrowserWindow({
webPreferences: {
allowRunningInsecureContent: false,
},
});

ESLint flat config exampleโ€‹

import sdl from "eslint-plugin-sdl-2";

export default [
{
plugins: { sdl },
rules: {
"sdl/no-electron-allow-running-insecure-content": "error",
},
},
];

When not to use itโ€‹

Disable only if your renderer never loads network content and your runtime has strict isolation controls documented outside this rule.

Package documentationโ€‹

Further readingโ€‹

Rule catalog ID: R009