Skip to main content

no-electron-disable-sandbox

Disallow disabling Electron renderer sandboxing in webPreferences.

Targeted pattern scopeโ€‹

This rule targets Electron BrowserWindow and BrowserView constructor options that set webPreferences.sandbox to false.

What this rule reportsโ€‹

This rule reports webPreferences.sandbox: false in Electron renderer configuration objects.

Why this rule existsโ€‹

Renderer sandboxing limits process privileges and helps contain renderer compromise impact.

โŒ Incorrectโ€‹

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

โœ… Correctโ€‹

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

ESLint flat config exampleโ€‹

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

export default [
{
plugins: { sdl },
rules: {
"sdl/no-electron-disable-sandbox": "error",
},
},
];

When not to use itโ€‹

Disable only while migrating legacy renderer code, and only with explicit risk acceptance and compensating controls.

Package documentationโ€‹

Further readingโ€‹

Rule catalog ID: R012