Skip to content

Commit

Permalink
Merge pull request #5953 from github/sauyon/java/spring-webutil
Browse files Browse the repository at this point in the history
Java: Add models for the Spring `web.util` package
  • Loading branch information
smowton authored Aug 18, 2021
2 parents 27df272 + 17cef3f commit cc4fe73
Show file tree
Hide file tree
Showing 75 changed files with 4,341 additions and 17 deletions.
4 changes: 4 additions & 0 deletions java/change-notes/2021-07-01-spring-webutil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
lgtm,codescanning
* Additional flow steps in the `org.springframework.web.util` package of the Spring framework have
been modelled. This may result in additional results for security queries on projects using this
framework.
1 change: 1 addition & 0 deletions java/ql/src/semmle/code/java/dataflow/ExternalFlow.qll
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ private module Frameworks {
private import semmle.code.java.frameworks.spring.SpringWebClient
private import semmle.code.java.frameworks.spring.SpringBeans
private import semmle.code.java.frameworks.spring.SpringWebMultipart
private import semmle.code.java.frameworks.spring.SpringWebUtil
private import semmle.code.java.security.ResponseSplitting
private import semmle.code.java.security.InformationLeak
private import semmle.code.java.security.GroovyInjection
Expand Down
1 change: 1 addition & 0 deletions java/ql/src/semmle/code/java/frameworks/spring/Spring.qll
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import semmle.code.java.frameworks.spring.SpringUtil
import semmle.code.java.frameworks.spring.SpringValidation
import semmle.code.java.frameworks.spring.SpringValue
import semmle.code.java.frameworks.spring.SpringWebMultipart
import semmle.code.java.frameworks.spring.SpringWebUtil
import semmle.code.java.frameworks.spring.SpringXMLElement
import semmle.code.java.frameworks.spring.metrics.MetricSpringBean
import semmle.code.java.frameworks.spring.metrics.MetricSpringBeanFile
176 changes: 176 additions & 0 deletions java/ql/src/semmle/code/java/frameworks/spring/SpringWebUtil.qll

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion java/ql/src/semmle/code/java/security/XSS.qll
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ private class DefaultXssSink extends XssSink {
/** A default sanitizer that considers numeric and boolean typed data safe for writing to output. */
private class DefaultXSSSanitizer extends XssSanitizer {
DefaultXSSSanitizer() {
this.getType() instanceof NumericType or this.getType() instanceof BooleanType
this.getType() instanceof NumericType or
this.getType() instanceof BooleanType or
// Match `org.springframework.web.util.HtmlUtils.htmlEscape` and possibly other methods like it.
this.asExpr().(MethodAccess).getMethod().getName().regexpMatch("(?i)html_?escape.*")
}
}

Expand Down
Loading

0 comments on commit cc4fe73

Please sign in to comment.