Skip to content

Commit c2baf0b

Browse files
committed
Added test where RegExp. is used after matchAll but it not flagged as potential issue
1 parent dbd57e3 commit c2baf0b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

javascript/ql/test/query-tests/Security/CWE-117/logInjectionBad.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,8 @@ const serverMatchAll = http.createServer((req, res) => {
123123
let otherStr = username.matchAll(/.*/g)[0]; // BAD
124124
console.log(otherStr);
125125
});
126+
127+
const serverMatchAl2l = http.createServer((req, res) => {
128+
const result = url.parse(req.url, true).query.username.matchAll(/(\d+)/g); // BAD - match is marked as vulnerable, while matchAll is not.
129+
console.log("First captured group:", RegExp.$1);
130+
});

0 commit comments

Comments
 (0)