Skip to content

Commit 9a5c0f6

Browse files
Sauyon Leeaschackmull
andcommitted
Java: Add HTML escapes as XSS sanitizers
Co-Authored-By: Anders Schack-Mulligen <[email protected]>
1 parent eb980e2 commit 9a5c0f6

File tree

1 file changed

+3
-0
lines changed
  • java/ql/src/semmle/code/java/security

1 file changed

+3
-0
lines changed

java/ql/src/semmle/code/java/security/XSS.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ private class DefaultXssSink extends XssSink {
9494
private class DefaultXSSSanitizer extends XssSanitizer {
9595
DefaultXSSSanitizer() {
9696
this.getType() instanceof NumericType or this.getType() instanceof BooleanType
97+
or
98+
// Match `org.springframework.web.util.HtmlUtils.htmlEscape` and possibly other methods like it.
99+
this.asExpr().(MethodAccess).getMethod().getName().regexpMatch("(?i)html_?escape.*")
97100
}
98101
}
99102

0 commit comments

Comments
 (0)