Conversation
…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 ( |
| }); | ||
| } | ||
|
|
||
| if (!process.argv.slice(2).length || !options.help || paraview.length === 0) { |
There was a problem hiding this comment.
Dropping the options.help is a behavior change, imho. @finetjul wdyt?
There was a problem hiding this comment.
This was intentional, not accidental — commander never populates opts().help for the built-in -h/--help flag (that flag is intercepted and the process exits during .parse(), before this code runs). So options.help was always undefined, and !options.help was always true, meaning the original condition printed help and exited unconditionally on every invocation regardless of arguments — the pvpython execFileSync branches were unreachable. This is fixed and explained in more detail in commit 73c8bac ("fix(DataGenerator): convert-cli no longer always prints help"), which is already part of this branch. Happy to add a comment in the code if that would help future readers, @finetjul let me know if you see it differently.
Addresses PR review comment on convert-cli.js line 63. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Please fix linting error (too long commit message) |
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