Contrary to spawn or execFile that accept a boolean value for the shell option disabling it, for execSync, the shell option only allows to provide a custom shell. Therefore, we raise a security hotspot when execSync() is used.
As you can see in the rule definition, exec() and execSync() are flagged as sensitive regardless of the shell option.
I see… So, in my scenario, changing execSync with spawnSync (with the right editions) should be the proper action, right?
As a suggestion it’d be nice to add a few more options in the Sensitive Code Example section. It’s not quite instantly clear that execSync with "shell": false is also sensitive.
Now that you mention it, it make sense, because shell’s default value is false.
However, if “false” is the default value for all the methods, then no explicit definition of “shell” should be compliant, too (for spawnSync).