Skip to content

Commit

Permalink
Added test where RegExp. is used after matchAll but it not flagged as…
Browse files Browse the repository at this point in the history
… potential issue
  • Loading branch information
Napalys committed Nov 8, 2024
1 parent dbd57e3 commit c2baf0b
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,8 @@ const serverMatchAll = http.createServer((req, res) => {
let otherStr = username.matchAll(/.*/g)[0]; // BAD
console.log(otherStr);
});

const serverMatchAl2l = http.createServer((req, res) => {
const result = url.parse(req.url, true).query.username.matchAll(/(\d+)/g); // BAD - match is marked as vulnerable, while matchAll is not.
console.log("First captured group:", RegExp.$1);
});

0 comments on commit c2baf0b

Please sign in to comment.