no-child-process-shell-true
Disallow Node child process options that enable shell: true.
Targeted pattern scopeโ
Node child_process execution options that enable shell: true.
What this rule reportsโ
spawn(...) / execFile(...) options objects with shell: true.
Why this rule existsโ
Shell execution expands injection risk when command fragments include user-influenced input.
โ Incorrectโ
spawn("cmd", ["/c", command], { shell: true });
โ Correctโ
spawn("node", ["script.js"], { shell: false });
ESLint flat config exampleโ
import sdl from "eslint-plugin-sdl-2";
export default [
{
plugins: { sdl },
rules: {
"sdl/no-child-process-shell-true": "error",
},
},
];
When not to use itโ
Disable only when shell execution is unavoidable and all command fragments are strictly controlled and validated.
Package documentationโ
Further readingโ
Rule catalog ID: R032