Skip to content

Commit c359675

Browse files
authored
Merge pull request #1802 from aschackmull/java/taint-step-extension-point
Java: Add a global extension point for taint steps.
2 parents f545455 + ae98d4f commit c359675

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

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

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,33 @@ predicate localAdditionalTaintStep(DataFlow::Node src, DataFlow::Node sink) {
4848
)
4949
}
5050

51+
private newtype TUnit = TMkUnit()
52+
53+
class Unit extends TUnit {
54+
string toString() { result = "unit" }
55+
}
56+
57+
/**
58+
* A unit class for adding additional taint steps.
59+
*
60+
* Extend this class to add additional taint steps that should apply to all
61+
* taint configurations.
62+
*/
63+
class AdditionalTaintStep extends Unit {
64+
/**
65+
* Holds if the step from `node1` to `node2` should be considered a taint
66+
* step for all configurations.
67+
*/
68+
abstract predicate step(DataFlow::Node node1, DataFlow::Node node2);
69+
}
70+
5171
/**
5272
* Holds if the additional step from `src` to `sink` should be included in all
5373
* global taint flow configurations.
5474
*/
5575
predicate defaultAdditionalTaintStep(DataFlow::Node src, DataFlow::Node sink) {
56-
localAdditionalTaintStep(src, sink)
76+
localAdditionalTaintStep(src, sink) or
77+
any(AdditionalTaintStep a).step(src, sink)
5778
}
5879

5980
/**

0 commit comments

Comments
 (0)