fix: execute git/npm subcommands with argv arrays - #127
Conversation
Replace interpolated shell strings with execFileSync argument arrays in GitCloner, npm-version-check, and the git config resolver so branch names, URLs, destinations, package names, and config keys are passed as single argv entries instead of being re-parsed by the shell.
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
Review complete. No blocking issues — approved ✅; 1 nitpick below. 🧹 Nitpicks (1) — 🟢 1 low
This change replaces string-based
Note: the sweep diff-reader pass did not publish (step-limit failure); findings are drawn from the adjudicated scanner passes. One low-severity test-hardening suggestion was kept. Reviewed commit: 5768bb2 |
Summary
Three call sites built shell command strings out of caller-supplied values, so any metacharacter in a branch name, repo URL, clone destination, package name, or git config key was re-parsed by
/bin/shinstead of being passed through as data. All three now useexecFileSyncwith an argv array (no shell), plus--before positional operands so values starting with-can't be read as flags.genomic/src/git/git-cloner.ts:genomic/src/utils/npm-version-check.ts:npm view ${packageName} version→execFileSync('npm', ['view', packageName, 'version'], ...).inquirerer/src/resolvers/git.ts:git config --global ${key}→execFileSync('git', ['config', '--global', '--', key], ...).Behavior is otherwise unchanged (same flags, same order, same stdio/encoding options). Tests that mocked
child_process.execSyncand asserted on the command string were updated to mockexecFileSyncand assert on the argv array;getNpmWhoamistill usesexecSync('npm whoami')(constant string) so that mock stays in place alongside the new one. Added a genomic case asserting a destination containing;arrives as one argv entry.Link to Devin session: https://app.devin.ai/sessions/bb89d57636c84c7383305191a303b1d4
Open in Devin Desktop: https://app.devin.ai/desktop/session/bb89d57636c84c7383305191a303b1d4?variant=devin
Requested by: @pyramation