Skip to content

Commit

Permalink
Merge pull request #93 from 418sec/master
Browse files Browse the repository at this point in the history
Security Fix for Command Injection - huntr.dev
  • Loading branch information
juanfran committed Sep 15, 2020
2 parents e74f2bc + 84eb609 commit b309fbf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/command.js
Expand Up @@ -48,8 +48,10 @@ function execCommand(command, options) {
shell: options.shell
};

command = command.split(' ');

if (options.sync || options.endless) {
var commandResult = child_process.execSync(command);
var commandResult = child_process.execFileSync(command[0], command.slice(1));
var error = null;

if (commandResult.status) {
Expand All @@ -58,7 +60,7 @@ function execCommand(command, options) {

resolve({error: error, report: commandResult.stdout});
} else {
child_process.exec(command, commandOptions, function(error, report) {
child_process.execFile(command[0], command.slice(1), commandOptions, function(error, report) {
resolve({error: error, report: report});
});
}
Expand Down

0 comments on commit b309fbf

Please sign in to comment.