mirror of
https://github.com/github/codeql.git
synced 2026-03-01 05:13:41 +01:00
Abstract Xss sanitizer
Turn the Xss sanitizer into an abstract class to support customizations and provide a default implementation.
This commit is contained in:
@@ -12,6 +12,8 @@ import semmle.code.java.dataflow.TaintTracking2
|
||||
|
||||
abstract class XssSink extends DataFlow::Node { }
|
||||
|
||||
abstract class XssSanitizer extends DataFlow::Node { }
|
||||
|
||||
private class DefaultXssSink extends XssSink {
|
||||
DefaultXssSink() {
|
||||
exists(HttpServletResponseSendErrorMethod m, MethodAccess ma |
|
||||
@@ -80,6 +82,12 @@ private class DefaultXssSink extends XssSink {
|
||||
}
|
||||
}
|
||||
|
||||
private class DefaultXSSSanitizer extends XssSanitizer {
|
||||
DefaultXSSSanitizer() {
|
||||
this.getType() instanceof NumericType or this.getType() instanceof BooleanType
|
||||
}
|
||||
}
|
||||
|
||||
private class ServletWriterSourceToWritingMethodFlowConfig extends TaintTracking2::Configuration {
|
||||
ServletWriterSourceToWritingMethodFlowConfig() {
|
||||
this = "XSS::ServletWriterSourceToWritingMethodFlowConfig"
|
||||
|
||||
Reference in New Issue
Block a user