Skip to content

Commit

Permalink
Unsafe shell command constructed from library input (#509)
Browse files Browse the repository at this point in the history
  • Loading branch information
lexie011 authored Jan 2, 2025
1 parent d0bb14f commit 47eaa4c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
22 changes: 15 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"minimist": "^1.2.8",
"replacestream": "^4.0.0",
"send-transform": "^0.15.1",
"shell-quote": "^1.8.2",
"socket.io": "^2.4.1",
"through2": "^4.0.2",
"uuid": "^9.0.0"
Expand Down
5 changes: 3 additions & 2 deletions src/browsers/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

const child_process = require('child_process');
const open = require('open');
const quote = require('shell-quote/quote');

const NOT_INSTALLED = 'The browser target is not installed: %target%';
const NOT_SUPPORTED = 'The browser target is not supported: %target%';
Expand Down Expand Up @@ -52,8 +53,8 @@ function launchBrowser(opts) {
if (target != 'edge') {
args.push(url);
}

const command = args.join(' ');
const command = quote(args);
const result = exec(command);
result.catch(() => {
throw new Error(NOT_INSTALLED.replace('%target%', target));
Expand Down

0 comments on commit 47eaa4c

Please sign in to comment.