JS: Fix: now one can determine regex via Array.prototype.toSpliced function call.

This commit is contained in:
Napalys 2024-11-14 15:34:14 +01:00
Родитель 2b0def1ed3
Коммит b333f523df
3 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -972,7 +972,7 @@ private predicate isUsedAsNumber(DataFlow::LocalSourceNode value) {
or
exists(DataFlow::CallNode call |
call.getCalleeName() =
["substring", "substr", "slice", "splice", "charAt", "charCodeAt", "codePointAt"] and
["substring", "substr", "slice", "splice", "charAt", "charCodeAt", "codePointAt", "toSpliced"] and
value.flowsTo(call.getAnArgument())
)
}

Просмотреть файл

@ -1,2 +1,3 @@
| tst.js:1:12:1:38 | '^http: ... le.com' | is a regular expression |
| tst.js:4:37:4:43 | 'regex' | is a regular expression |
| tst.js:9:37:9:43 | 'regex' | is a regular expression |

Просмотреть файл

@ -6,6 +6,6 @@ function detectRegexViaSplice(string) {
};
function detectRegexViaToSpliced(string) {
let found = getMyThing().search('regex'); // NOT OK -- Should be marked as regular expression but it is not.
let found = getMyThing().search('regex'); // NOT OK
arr.toSpliced(found, 1);
};