Skip to content

Commit

Permalink
Java: temp test case fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Jami Cogswell authored and Jami Cogswell committed Feb 19, 2025
1 parent 622d854 commit ac328fd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions java/ql/lib/semmle/code/java/security/PathSanitizer.qll
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ private class DirectoryCharactersGuard extends PathGuard {
checkedExpr = mc.getQualifier() and
this = mc
|
// TODO: improve the below
// Allow anything except `.`, '/', '\'
(
not target.getStringValue().matches("%[^%]%") and
Expand All @@ -439,8 +440,8 @@ private class DirectoryCharactersGuard extends PathGuard {
// Disallow `.`, '/', '\'
(
not target.getStringValue().matches("%[^%" + ["\\.", "/", "\\\\"] + "%]%") and
// Assuming a regex containing line breaks is correctly matching line breaks in a string
target.getStringValue().matches("%" + ["\\.", "/", "\\\\"] + "%")
target.getStringValue().matches("%" + ["\\.", "/", "\\\\"] + "%") and
not isStringPartialMatch(mc) // ! temporary test case fix; remove
) and
branch = false
)
Expand Down

0 comments on commit ac328fd

Please sign in to comment.