harden: if unverified user data can reach the exec me... in... - #3616
harden: if unverified user data can reach the exec me... in...#3616anupamme wants to merge 3 commits into
exec me... in...#3616Conversation
…injection security vulnerability Automated security fix generated by OrbisAI Security
7828c33 to
e59906d
Compare
|
done. pls review. |
finetjul
left a comment
There was a problem hiding this comment.
Why not extend the reasoning to shell.find ?
|
shell.find() is worth considering because --paraview can influence the paths it receives, but I don’t think it has the same command-injection sink semantics as shell.exec(). find() performs filesystem traversal rather than passing a constructed string to a system shell. The actual injection primitive was the cmdLine.join(' ') → shell.exec() path, which is now replaced with execFileSync() and preserves argument boundaries. That said, I’ll add a regression test covering shell metacharacters in --input/--output to make the security property explicit. |
The help-check condition tested `!options.help`, but commander never populates `opts().help` (the built-in -h/--help flag is intercepted and exits before reaching this line, outside `_optionValues`). This made the condition always true, so the CLI printed help and exited on every invocation, leaving the pvpython execFileSync calls unreachable.
…--input/--output Spawns convert-cli.js against a stub pvpython and asserts that shell metacharacters passed via --input/--output are never interpreted by a shell and reach pvpython as literal argv, verifying the shell.exec() -> execFileSync() fix.
|
Added a regression test ( While wiring this test up end-to-end, I found that the CLI's help-check condition ( |
Summary
Harden input handling in
Utilities/DataGenerator/convert-cli.js(flagged by semgrep).Vulnerability
javascript.shelljs.security.shelljs-exec-injection.shelljs-exec-injectionUtilities/DataGenerator/convert-cli.js:68Description: If unverified user data can reach the
execmethod it can result in Remote Code ExecutionThreat Model Context
This is a Node.js library - vulnerabilities affect downstream consumers who use this package.
Changes
Utilities/DataGenerator/convert-cli.jsBehavior Preservation
The change is scoped to 1 file on the vulnerable path; it only tightens handling of untrusted input and leaves valid inputs unaffected.
This patch removes an exploit primitive — a code pattern that, while not independently exploitable today, could be chained with other weaknesses by automated exploit-development tooling. Proactive removal of such primitives raises the bar against increasingly capable automated attack tools.
Automated security fix by OrbisAI Security