Added test where RegExp. is used after matchAll but it not flagged as potential issue

This commit is contained in:
Napalys
2024-11-08 08:56:12 +01:00
parent dbd57e3870
commit c2baf0bd6d

View File

@@ -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);
});