no-electron-permission-check-handler-allow-all
Disallow Electron setPermissionCheckHandler callbacks that unconditionally
return true.
Targeted pattern scopeโ
This rule targets setPermissionCheckHandler(...) callbacks that always return
true for every permission check.
What this rule reportsโ
This rule reports inline permission check handlers that resolve to true
without inspecting the request context or permission name.
Why this rule existsโ
Blindly approving every permission check weakens Electron's permission boundary and can expose capabilities such as media access, notifications, and clipboard operations to content that should not receive them.
โ Incorrectโ
session.defaultSession.setPermissionCheckHandler(() => true);
โ Correctโ
session.defaultSession.setPermissionCheckHandler(
(_webContents, permission) => permission === "fullscreen"
);
ESLint flat config exampleโ
import sdl from "eslint-plugin-sdl-2";
export default [
{
plugins: { sdl },
rules: {
"sdl/no-electron-permission-check-handler-allow-all": "error",
},
},
];
When not to use itโ
Disable only if a reviewed Electron permission policy deliberately allows every checked permission in a constrained environment.
Package documentationโ
Further readingโ
Rule catalog ID: R050