Skip to main content

no-electron-dangerous-blink-features

Disallow enabling Blink runtime features through Electron webPreferences.enableBlinkFeatures.

Targeted pattern scopeโ€‹

This rule targets Electron BrowserWindow and BrowserView constructor options that set webPreferences.enableBlinkFeatures to a non-empty static string.

What this rule reportsโ€‹

This rule reports non-empty enableBlinkFeatures values in webPreferences objects.

Why this rule existsโ€‹

enableBlinkFeatures turns on Chromium/Blink runtime feature flags. Enabling extra features in production renderer contexts can increase attack surface and weaken predictable browser hardening.

โŒ Incorrectโ€‹

new BrowserWindow({
webPreferences: {
enableBlinkFeatures: "CSSVariables,LayoutNG",
},
});

โœ… Correctโ€‹

new BrowserWindow({
webPreferences: {
enableBlinkFeatures: "",
},
});

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

ESLint flat config exampleโ€‹

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

export default [
{
plugins: { sdl },
rules: {
"sdl/no-electron-dangerous-blink-features": "error",
},
},
];

When not to use itโ€‹

Disable if your application has reviewed, tightly scoped, and well-documented Blink feature requirements with compensating security controls.

Package documentationโ€‹

Further readingโ€‹

Rule catalog ID: R010