Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 576dbcb

Browse files
committed
JS: Stop overriding entire module.exports object in test
Doing `module.exports = blah` prevents other exports from being seen as library inputs.
1 parent f72cd21 commit 576dbcb

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • javascript/ql/test/query-tests/Security/CWE-078/UnsafeShellCommandConstruction/lib

javascript/ql/test/query-tests/Security/CWE-078/UnsafeShellCommandConstruction/lib/lib.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var cp = require("child_process")
22

3-
module.exports = function (name) {
3+
module.exports.blah = function (name) {
44
cp.exec("rm -rf " + name); // $ Alert
55

66
cp.execFile(name, [name]);
@@ -19,7 +19,7 @@ function cla() { }
1919
cla.prototype.method = function (name) {
2020
cp.exec("rm -rf " + name); // $ Alert
2121
}
22-
module.exports = new cla();
22+
module.exports.cla = new cla();
2323

2424

2525
function cla2() { }
@@ -474,7 +474,7 @@ const {promisify} = require('util');
474474

475475
const exec = promisify(require('child_process').exec);
476476

477-
module.exports = function check(config) {
477+
module.exports.check = function check(config) {
478478
const cmd = path.join(config.installedPath, 'myBinary -v'); // $ Alert
479479
return exec(cmd);
480480
}

0 commit comments

Comments
 (0)