Skip to content

Commit

Permalink
Security Fix for Command Injection - huntr.dev (facebook#10644)
Browse files Browse the repository at this point in the history
* Update getProcessForPort.js

* Update getProcessForPort.js

Co-authored-by: Zhou Peng <zpbrent@gmail.com>
Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
  • Loading branch information
3 people authored and akxcv committed Apr 28, 2021
1 parent bdc5381 commit d70d014
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/react-dev-utils/getProcessForPort.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

var chalk = require('chalk');
var execSync = require('child_process').execSync;
var execFileSync = require('child_process').execFileSync;
var path = require('path');

var execOptions = {
Expand All @@ -25,7 +26,7 @@ function isProcessAReactApp(processCommand) {
}

function getProcessIdOnPort(port) {
return execSync('lsof -i:' + port + ' -P -t -sTCP:LISTEN', execOptions)
return execFileSync('lsof', ['-i:' + port, '-P', '-t', '-sTCP:LISTEN'], execOptions)
.split('\n')[0]
.trim();
}
Expand Down

0 comments on commit d70d014

Please sign in to comment.