Skip to content

Commit

Permalink
Update javascript/ql/src/Security/CWE-178/CaseSensitiveMiddlewarePath.ql
Browse files Browse the repository at this point in the history
Co-authored-by: Erik Krogh Kristensen <[email protected]>
  • Loading branch information
Napalys and erik-krogh committed Nov 25, 2024
1 parent e38b63e commit d6372ae
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ predicate isCaseSensitiveMiddleware(
regexp.getAReference().flowsTo(arg) and
exists(string flags |
flags = regexp.tryGetFlags() and
not RegExp::isIgnoreCase(flags)
not RegExp::maybeIgnoreCase(flags)
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@
| tst.js:76:9:76:20 | /\\/baz\\/bla/ | This route uses a case-sensitive path $@, but is guarding a $@. A path such as '/BAZ/BLA' will bypass the middleware. | tst.js:76:9:76:20 | /\\/baz\\/bla/ | pattern | tst.js:77:1:79:2 | app.get ... });\\n}) | case-insensitive path |
| tst.js:86:9:86:30 | /\\/[Bb] ... 3\\/[a]/ | This route uses a case-sensitive path $@, but is guarding a $@. A path such as '/BAZ3/A' will bypass the middleware. | tst.js:86:9:86:30 | /\\/[Bb] ... 3\\/[a]/ | pattern | tst.js:87:1:89:2 | app.get ... });\\n}) | case-insensitive path |
| tst.js:91:9:91:40 | /\\/summ ... ntGame/ | This route uses a case-sensitive path $@, but is guarding a $@. A path such as '/CURRENTGAME' will bypass the middleware. | tst.js:91:9:91:40 | /\\/summ ... ntGame/ | pattern | tst.js:93:1:95:2 | app.get ... O");\\n}) | case-insensitive path |
| tst.js:98:5:98:43 | new Reg ... Flag()) | This route uses a case-sensitive path $@, but is guarding a $@. A path such as '/BAR/1' will bypass the middleware. | tst.js:98:5:98:43 | new Reg ... Flag()) | pattern | tst.js:107:1:108:2 | app.get ... ware\\n}) | case-insensitive path |
2 changes: 1 addition & 1 deletion javascript/ql/test/query-tests/Security/CWE-178/tst.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ app.get('/currentGame', function (req, res) {
});

app.get(
new RegExp('^/bar(.*)?', unknownFlag()), // NOT OK - Might be OK if the unknown flag evaluates to case insensitive one
new RegExp('^/bar(.*)?', unknownFlag()), // OK - Might be OK if the unknown flag evaluates to case insensitive one
unknown(),
function(req, res, next) {
if (req.params.blah) {
Expand Down

0 comments on commit d6372ae

Please sign in to comment.