Skip to content

Commit ae98d4f

Browse files
committed
Java: Change extension point to use a unit type.
1 parent ef0c6d0 commit ae98d4f

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,24 @@ predicate localAdditionalTaintStep(DataFlow::Node src, DataFlow::Node sink) {
4040
)
4141
}
4242

43+
private newtype TUnit = TMkUnit()
44+
45+
class Unit extends TUnit {
46+
string toString() { result = "unit" }
47+
}
48+
4349
/**
44-
* A `DataFlow::Node` that is the origin of a taint step.
50+
* A unit class for adding additional taint steps.
4551
*
4652
* Extend this class to add additional taint steps that should apply to all
4753
* taint configurations.
4854
*/
49-
abstract class AdditionalTaintStepNode extends DataFlow::Node {
55+
class AdditionalTaintStep extends Unit {
5056
/**
51-
* Gets a `DataFlow::Node` that this node can step to in one taint step.
57+
* Holds if the step from `node1` to `node2` should be considered a taint
58+
* step for all configurations.
5259
*/
53-
abstract DataFlow::Node step();
60+
abstract predicate step(DataFlow::Node node1, DataFlow::Node node2);
5461
}
5562

5663
/**
@@ -59,7 +66,7 @@ abstract class AdditionalTaintStepNode extends DataFlow::Node {
5966
*/
6067
predicate defaultAdditionalTaintStep(DataFlow::Node src, DataFlow::Node sink) {
6168
localAdditionalTaintStep(src, sink) or
62-
src.(AdditionalTaintStepNode).step() = sink
69+
any(AdditionalTaintStep a).step(src, sink)
6370
}
6471

6572
/**

0 commit comments

Comments
 (0)