Skip to content

Commit 01e1fc4

Browse files
committed
JS: Move some Alerts to their actual location
1 parent 928d962 commit 01e1fc4

File tree

1 file changed

+4
-4
lines changed
  • javascript/ql/test/query-tests/Security/CWE-022/TaintedPath

1 file changed

+4
-4
lines changed

javascript/ql/test/query-tests/Security/CWE-022/TaintedPath/handlebars.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ const data = {};
88

99
function init() {
1010
hb.registerHelper("catFile", function catFile(filePath) {
11-
return fs.readFileSync(filePath); // SINK (reads file)
11+
return fs.readFileSync(filePath); // $ Alert
1212
});
1313
hb.registerHelper("prependToLines", function prependToLines(prefix, filePath) {
1414
return fs
15-
.readFileSync(filePath)
15+
.readFileSync(filePath) // $ Alert
1616
.split("\n")
1717
.map((line) => prefix + line)
1818
.join("\n");
@@ -26,7 +26,7 @@ function init() {
2626
init();
2727

2828
app.get('/some/path1', function (req, res) {
29-
res.send(data.compiledFileAccess({ path: req.params.path })); // $ Alert - template uses vulnerable catFile
29+
res.send(data.compiledFileAccess({ path: req.params.path })); // template uses vulnerable catFile
3030
});
3131

3232
app.get('/some/path2', function (req, res) {
@@ -40,7 +40,7 @@ app.get('/some/path3', function (req, res) {
4040
app.get('/some/path4', function (req, res) {
4141
res.send(data.compiledMixed({
4242
prefix: ">>> ",
43-
path: req.params.path // $ Alert - template uses vulnerable helper
43+
path: req.params.path // template uses vulnerable helper
4444
}));
4545
});
4646

0 commit comments

Comments
 (0)