Don't run the spawned program in a shell.

Instead, run it directly. This avoids false positives when running
non-bash commands and false negatives when trying to run a shell.
This commit is contained in:
Mark Stemm 2016-08-09 10:32:40 -07:00
parent f82288f373
commit bf431cf222

View File

@ -14,8 +14,8 @@ router.get('/', function(req, res) {
});
router.get('/exec/:cmd', function(req, res) {
var output = child_process.execSync(req.params.cmd);
res.send(output);
var ret = child_process.spawnSync(req.params.cmd);
res.send(ret.stdout);
});
app.use('/api', router);