Skip to content

Commit 3e7ea34

Browse files
committed
XSS: expose extension point for defining barrier sinks
1 parent 10a6089 commit 3e7ea34

File tree

2 files changed

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

2 files changed

+8
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ class XSSConfig extends TaintTracking::Configuration {
2525

2626
override predicate isSanitizer(DataFlow::Node node) { node instanceof XssSanitizer }
2727

28+
override predicate isSanitizerOut(DataFlow::Node node) { node instanceof XssSinkBarrier }
29+
2830
override predicate isAdditionalTaintStep(DataFlow::Node node1, DataFlow::Node node2) {
2931
any(XssAdditionalTaintStep s).step(node1, node2)
3032
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ abstract class XssSink extends DataFlow::Node { }
1515
/** A sanitizer that neutralizes dangerous characters that can be used to perform a XSS attack. */
1616
abstract class XssSanitizer extends DataFlow::Node { }
1717

18+
/**
19+
* A sink that represent a method that outputs data without applying contextual output encoding,
20+
* and which should truncate flow paths such that downstream sinks are not flagged as well.
21+
*/
22+
abstract class XssSinkBarrier extends XssSink { }
23+
1824
/**
1925
* A unit class for adding additional taint steps.
2026
*

0 commit comments

Comments
 (0)