Skip to content

fix(cli): remove shell:true from spawn in generate command#2270

Merged
fahreddinozcan merged 2 commits intoupstash:masterfrom
mvanhorn:fix/remove-spawn-shell-true
Mar 19, 2026
Merged

fix(cli): remove shell:true from spawn in generate command#2270
fahreddinozcan merged 2 commits intoupstash:masterfrom
mvanhorn:fix/remove-spawn-shell-true

Conversation

@mvanhorn
Copy link
Copy Markdown
Contributor

Summary

  • Removes shell: true from the child_process.spawn() call in the generate command's "open in editor" flow
  • The editor binary and file path are already passed as separate arguments to spawn(), so shell interpolation is not needed
  • With shell: true, a malicious $EDITOR value or a crafted file path containing shell metacharacters could execute arbitrary commands

Details

In packages/cli/src/commands/generate.ts line 440, the spawn call uses shell: true unnecessarily. Node's spawn without shell: true executes the binary directly via execvp, which safely handles arguments without shell interpretation.

This is a one-line removal. No behavior change for normal editor values like vim, nano, code, or open.

Fixes #2240

This contribution was developed with AI assistance (Claude Code).

Removes shell:true from the child_process.spawn() call that opens
the user's editor. The editor path and preview file path are already
passed as separate arguments, so shell interpolation is unnecessary.
Using shell:true allows shell metacharacters in EDITOR or file paths
to be interpreted, which is a command injection vector.

Fixes upstash#2240

This contribution was developed with AI assistance (Claude Code).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@fahreddinozcan fahreddinozcan merged commit 93eaf54 into upstash:master Mar 19, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Security] exec() usage — potential command injection surface

2 participants