mirror of
https://github.com/github/codeql.git
synced 2026-05-04 13:15:21 +02:00
JS: add tests for missing flow of regular expressions
This commit is contained in:
@@ -60,3 +60,12 @@ function badPercentEscape(s) {
|
||||
s = s.replace(/%/g, '%25');
|
||||
return s;
|
||||
}
|
||||
|
||||
function badEncode(s) {
|
||||
var indirect1 = /"/g;
|
||||
var indirect2 = /'/g;
|
||||
var indirect3 = /&/g;
|
||||
return s.replace(indirect1, """)
|
||||
.replace(indirect2, "'")
|
||||
.replace(indirect3, "&");
|
||||
}
|
||||
|
||||
@@ -163,3 +163,8 @@ app.get('/some/path', function(req, res) {
|
||||
flowifyComments(untrusted);
|
||||
good11(untrusted);
|
||||
});
|
||||
|
||||
(function (s) {
|
||||
var indirect = /'/;
|
||||
return s.replace(indirect, ""); // NOT OK
|
||||
});
|
||||
|
||||
@@ -1,2 +1,7 @@
|
||||
// NOT OK
|
||||
window.location = /.*redirect=([^&]*).*/.exec(document.location.href)[1];
|
||||
|
||||
(function(){
|
||||
var indirect = /.*redirect=([^&]*).*/;
|
||||
window.location = indirect.exec(document.location.href)[1];
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user