Skip to content

Commit 8db5c4f

Browse files
committed
Abstract additional taint step
1 parent 518459c commit 8db5c4f

File tree

2 files changed

+18
-0
lines changed
  • java/ql/src

2 files changed

+18
-0
lines changed

java/ql/src/Security/CWE/CWE-079/XSS.ql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ class XSSConfig extends TaintTracking::Configuration {
2323
override predicate isSink(DataFlow::Node sink) { sink instanceof XssSink }
2424

2525
override predicate isSanitizer(DataFlow::Node node) { node instanceof XssSanitizer }
26+
27+
override predicate isAdditionalTaintStep(DataFlow::Node node1, DataFlow::Node node2) {
28+
any(XssAdditionalTaintStep s).step(node1, node2)
29+
}
2630
}
2731

2832
from DataFlow::PathNode source, DataFlow::PathNode sink, XSSConfig conf

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,20 @@ abstract class XssSink extends DataFlow::Node { }
1414

1515
abstract class XssSanitizer extends DataFlow::Node { }
1616

17+
/**
18+
* A unit class for adding additional taint steps.
19+
*
20+
* Extend this class to add additional taint steps that should apply to the XSS
21+
* taint configuration.
22+
*/
23+
abstract class XssAdditionalTaintStep extends TaintTracking2::Unit {
24+
/**
25+
* Holds if the step from `node1` to `node2` should be considered a taint
26+
* step for all configurations.
27+
*/
28+
abstract predicate step(DataFlow::Node node1, DataFlow::Node node2);
29+
}
30+
1731
private class DefaultXssSink extends XssSink {
1832
DefaultXssSink() {
1933
exists(HttpServletResponseSendErrorMethod m, MethodAccess ma |

0 commit comments

Comments
 (0)