Skip to content

Commit ef0c6d0

Browse files
committed
Java: Add a global extension point for taint steps.
1 parent 0801e51 commit ef0c6d0

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

java/ql/src/semmle/code/java/dataflow/internal/TaintTrackingUtil.qll

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,26 @@ predicate localAdditionalTaintStep(DataFlow::Node src, DataFlow::Node sink) {
4040
)
4141
}
4242

43+
/**
44+
* A `DataFlow::Node` that is the origin of a taint step.
45+
*
46+
* Extend this class to add additional taint steps that should apply to all
47+
* taint configurations.
48+
*/
49+
abstract class AdditionalTaintStepNode extends DataFlow::Node {
50+
/**
51+
* Gets a `DataFlow::Node` that this node can step to in one taint step.
52+
*/
53+
abstract DataFlow::Node step();
54+
}
55+
4356
/**
4457
* Holds if the additional step from `src` to `sink` should be included in all
4558
* global taint flow configurations.
4659
*/
4760
predicate defaultAdditionalTaintStep(DataFlow::Node src, DataFlow::Node sink) {
48-
localAdditionalTaintStep(src, sink)
61+
localAdditionalTaintStep(src, sink) or
62+
src.(AdditionalTaintStepNode).step() = sink
4963
}
5064

5165
/**

0 commit comments

Comments
 (0)