Skip to content

remotion: Fix shell command built from environment values open-in-editor #5334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

odaysec
Copy link

@odaysec odaysec commented May 30, 2025

child_process.exec(`${where} "${editor.command}"`, (err) => {
if (err) {
resolve(editor.process);
} else {
resolve(editor.command);
}
});
});
return new Promise((resolve, reject) => {
if (process.platform === 'win32') {
// On Windows, launch the editor in a shell because spawn can only
// launch .exe files.
_childProcess = child_process.spawn(
'cmd.exe',
['/C', binaryToUse].concat(args),

_childProcess = child_process.spawn(
'cmd.exe',
['/C', binaryToUse].concat(args),
{stdio: 'inherit', detached: true},
);

Fix the issue will replace the use of child_process.exec and child_process.spawn with safer alternatives. Specifically:

  1. Use child_process.spawn with separate arguments instead of dynamically constructing the command string.
  2. Ensure that all inputs (e.g., binaryToUse, args, and fileName) are properly sanitized or validated before being passed to the spawn function.
  3. Replace the child_process.exec call used to resolve binaryToUse with child_process.execFile, which avoids shell interpretation of the command and its arguments.

These changes will ensure that special characters in environment values or user inputs do not alter the behavior of the shell command unexpectedly.


Copy link

vercel bot commented May 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
bugs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 30, 2025 3:13pm
remotion ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 30, 2025 3:13pm

@JonnyBurger
Copy link
Member

Thanks!

Does this fix an actual security problem or is it precautionary?
What would the attack vector be?

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.

2 participants