5
5
6
6
private import CaptureModelsSpecific
7
7
8
- class TargetApi = TargetApiSpecific ;
8
+ class DataFlowTargetApi extends TargetApiSpecific {
9
+ DataFlowTargetApi ( ) { isRelevantForDataFlowModels ( this ) }
10
+ }
9
11
10
12
/**
11
13
* Holds if data can flow from `node1` to `node2` either via a read or a write of an intermediate field `f`.
@@ -40,37 +42,39 @@ private predicate isRelevantContent(DataFlow::Content c) {
40
42
* Gets the summary model for `api` with `input`, `output` and `kind`.
41
43
*/
42
44
bindingset [ input, output, kind]
43
- private string asSummaryModel ( TargetApi api , string input , string output , string kind ) {
45
+ private string asSummaryModel ( TargetApiSpecific api , string input , string output , string kind ) {
44
46
result =
45
47
asPartialModel ( api ) + input + ";" //
46
48
+ output + ";" //
47
49
+ kind + ";" //
48
50
+ "generated"
49
51
}
50
52
51
- string asNegativeSummaryModel ( TargetApi api ) { result = asPartialNegativeModel ( api ) + "generated" }
53
+ string asNegativeSummaryModel ( TargetApiSpecific api ) {
54
+ result = asPartialNegativeModel ( api ) + "generated"
55
+ }
52
56
53
57
/**
54
58
* Gets the value summary model for `api` with `input` and `output`.
55
59
*/
56
60
bindingset [ input, output]
57
- private string asValueModel ( TargetApi api , string input , string output ) {
61
+ string asValueModel ( TargetApiSpecific api , string input , string output ) {
58
62
result = asSummaryModel ( api , input , output , "value" )
59
63
}
60
64
61
65
/**
62
66
* Gets the taint summary model for `api` with `input` and `output`.
63
67
*/
64
68
bindingset [ input, output]
65
- private string asTaintModel ( TargetApi api , string input , string output ) {
69
+ private string asTaintModel ( TargetApiSpecific api , string input , string output ) {
66
70
result = asSummaryModel ( api , input , output , "taint" )
67
71
}
68
72
69
73
/**
70
74
* Gets the sink model for `api` with `input` and `kind`.
71
75
*/
72
76
bindingset [ input, kind]
73
- private string asSinkModel ( TargetApi api , string input , string kind ) {
77
+ private string asSinkModel ( TargetApiSpecific api , string input , string kind ) {
74
78
result =
75
79
asPartialModel ( api ) + input + ";" //
76
80
+ kind + ";" //
@@ -81,7 +85,7 @@ private string asSinkModel(TargetApi api, string input, string kind) {
81
85
* Gets the source model for `api` with `output` and `kind`.
82
86
*/
83
87
bindingset [ output, kind]
84
- private string asSourceModel ( TargetApi api , string output , string kind ) {
88
+ private string asSourceModel ( TargetApiSpecific api , string output , string kind ) {
85
89
result =
86
90
asPartialModel ( api ) + output + ";" //
87
91
+ kind + ";" //
@@ -91,7 +95,7 @@ private string asSourceModel(TargetApi api, string output, string kind) {
91
95
/**
92
96
* Gets the summary model of `api`, if it follows the `fluent` programming pattern (returns `this`).
93
97
*/
94
- string captureQualifierFlow ( TargetApi api ) {
98
+ string captureQualifierFlow ( TargetApiSpecific api ) {
95
99
exists ( DataFlowImplCommon:: ReturnNodeExt ret |
96
100
api = returnNodeEnclosingCallable ( ret ) and
97
101
isOwnInstanceAccessNode ( ret )
@@ -140,7 +144,7 @@ private class ThroughFlowConfig extends TaintTracking::Configuration {
140
144
141
145
override predicate isSource ( DataFlow:: Node source , DataFlow:: FlowState state ) {
142
146
source instanceof DataFlow:: ParameterNode and
143
- source .getEnclosingCallable ( ) instanceof TargetApi and
147
+ source .getEnclosingCallable ( ) instanceof DataFlowTargetApi and
144
148
state .( TaintRead ) .getStep ( ) = 0
145
149
}
146
150
@@ -184,7 +188,7 @@ private class ThroughFlowConfig extends TaintTracking::Configuration {
184
188
/**
185
189
* Gets the summary model(s) of `api`, if there is flow from parameters to return value or parameter.
186
190
*/
187
- string captureThroughFlow ( TargetApi api ) {
191
+ string captureThroughFlow ( DataFlowTargetApi api ) {
188
192
exists (
189
193
ThroughFlowConfig config , DataFlow:: ParameterNode p ,
190
194
DataFlowImplCommon:: ReturnNodeExt returnNodeExt , string input , string output
@@ -211,7 +215,7 @@ private class FromSourceConfiguration extends TaintTracking::Configuration {
211
215
override predicate isSource ( DataFlow:: Node source ) { ExternalFlow:: sourceNode ( source , _) }
212
216
213
217
override predicate isSink ( DataFlow:: Node sink ) {
214
- exists ( TargetApi c |
218
+ exists ( DataFlowTargetApi c |
215
219
sink instanceof DataFlowImplCommon:: ReturnNodeExt and
216
220
sink .getEnclosingCallable ( ) = c
217
221
)
@@ -229,7 +233,7 @@ private class FromSourceConfiguration extends TaintTracking::Configuration {
229
233
/**
230
234
* Gets the source model(s) of `api`, if there is flow from an existing known source to the return of `api`.
231
235
*/
232
- string captureSource ( TargetApi api ) {
236
+ string captureSource ( DataFlowTargetApi api ) {
233
237
exists ( DataFlow:: Node source , DataFlow:: Node sink , FromSourceConfiguration config , string kind |
234
238
config .hasFlow ( source , sink ) and
235
239
ExternalFlow:: sourceNode ( source , kind ) and
@@ -259,7 +263,7 @@ private class PropagateToSinkConfiguration extends PropagateToSinkConfigurationS
259
263
/**
260
264
* Gets the sink model(s) of `api`, if there is flow from a parameter to an existing known sink.
261
265
*/
262
- string captureSink ( TargetApi api ) {
266
+ string captureSink ( DataFlowTargetApi api ) {
263
267
exists ( DataFlow:: Node src , DataFlow:: Node sink , PropagateToSinkConfiguration config , string kind |
264
268
config .hasFlow ( src , sink ) and
265
269
ExternalFlow:: sinkNode ( sink , kind ) and
0 commit comments