|
5 | 5 |
|
6 | 6 | private import CaptureModelsSpecific |
7 | 7 |
|
| 8 | +class ActiveConfiguration extends Unit { |
| 9 | + predicate activateThroughFlowConfig() { none() } |
| 10 | + |
| 11 | + predicate activateFromSourceConfig() { none() } |
| 12 | + |
| 13 | + predicate activateToSinkConfig() { none() } |
| 14 | +} |
| 15 | + |
8 | 16 | class DataFlowTargetApi extends TargetApiSpecific { |
9 | 17 | DataFlowTargetApi() { isRelevantForDataFlowModels(this) } |
10 | 18 | } |
@@ -140,7 +148,9 @@ private class TaintStore extends DataFlow::FlowState { |
140 | 148 | * This can be used to generate Flow summaries for APIs from parameter to return. |
141 | 149 | */ |
142 | 150 | private class ThroughFlowConfig extends TaintTracking::Configuration { |
143 | | - ThroughFlowConfig() { this = "ThroughFlowConfig" } |
| 151 | + ThroughFlowConfig() { |
| 152 | + this = "ThroughFlowConfig" and any(ActiveConfiguration ac).activateThroughFlowConfig() |
| 153 | + } |
144 | 154 |
|
145 | 155 | override predicate isSource(DataFlow::Node source, DataFlow::FlowState state) { |
146 | 156 | source instanceof DataFlow::ParameterNode and |
@@ -210,7 +220,9 @@ string captureThroughFlow(DataFlowTargetApi api) { |
210 | 220 | * via its return (then the API itself becomes a source). |
211 | 221 | */ |
212 | 222 | private class FromSourceConfiguration extends TaintTracking::Configuration { |
213 | | - FromSourceConfiguration() { this = "FromSourceConfiguration" } |
| 223 | + FromSourceConfiguration() { |
| 224 | + this = "FromSourceConfiguration" and any(ActiveConfiguration ac).activateFromSourceConfig() |
| 225 | + } |
214 | 226 |
|
215 | 227 | override predicate isSource(DataFlow::Node source) { ExternalFlow::sourceNode(source, _) } |
216 | 228 |
|
@@ -250,8 +262,13 @@ string captureSource(DataFlowTargetApi api) { |
250 | 262 | * This can be used to generate Sink summaries for APIs, if the API propagates a parameter (or enclosing type field) |
251 | 263 | * into an existing known sink (then the API itself becomes a sink). |
252 | 264 | */ |
253 | | -private class PropagateToSinkConfiguration extends PropagateToSinkConfigurationSpecific { |
254 | | - PropagateToSinkConfiguration() { this = "parameters or fields flowing into sinks" } |
| 265 | +private class PropagateToSinkConfiguration extends TaintTracking::Configuration { |
| 266 | + PropagateToSinkConfiguration() { |
| 267 | + this = "parameters or fields flowing into sinks" and |
| 268 | + any(ActiveConfiguration ac).activateToSinkConfig() |
| 269 | + } |
| 270 | + |
| 271 | + override predicate isSource(DataFlow::Node source) { apiSource(source) } |
255 | 272 |
|
256 | 273 | override predicate isSink(DataFlow::Node sink) { ExternalFlow::sinkNode(sink, _) } |
257 | 274 |
|
|
0 commit comments