4
4
*/
5
5
6
6
private import CaptureModelsSpecific
7
+ private import CaptureModelsPrinting
7
8
8
9
class DataFlowTargetApi extends TargetApiSpecific {
9
10
DataFlowTargetApi ( ) { isRelevantForDataFlowModels ( this ) }
10
11
}
11
12
13
+ private module Printing implements PrintingSig {
14
+ class Api = DataFlowTargetApi ;
15
+
16
+ string getProvenance ( ) { result = "df-generated" }
17
+ }
18
+
19
+ module ModelPrinting = PrintingImpl< Printing > ;
20
+
12
21
/**
13
22
* Holds if data can flow from `node1` to `node2` either via a read or a write of an intermediate field `f`.
14
23
*/
@@ -52,58 +61,6 @@ string parameterNodeAsInput(DataFlow::ParameterNode p) {
52
61
*/
53
62
string asInputArgument ( DataFlow:: Node source ) { result = asInputArgumentSpecific ( source ) }
54
63
55
- /**
56
- * Gets the summary model for `api` with `input`, `output` and `kind`.
57
- */
58
- bindingset [ input, output, kind]
59
- private string asSummaryModel ( TargetApiSpecific api , string input , string output , string kind ) {
60
- result =
61
- asPartialModel ( api ) + input + ";" //
62
- + output + ";" //
63
- + kind + ";" //
64
- + "generated"
65
- }
66
-
67
- string asNeutralModel ( TargetApiSpecific api ) { result = asPartialNeutralModel ( api ) + "generated" }
68
-
69
- /**
70
- * Gets the value summary model for `api` with `input` and `output`.
71
- */
72
- bindingset [ input, output]
73
- string asValueModel ( TargetApiSpecific api , string input , string output ) {
74
- result = asSummaryModel ( api , input , output , "value" )
75
- }
76
-
77
- /**
78
- * Gets the taint summary model for `api` with `input` and `output`.
79
- */
80
- bindingset [ input, output]
81
- private string asTaintModel ( TargetApiSpecific api , string input , string output ) {
82
- result = asSummaryModel ( api , input , output , "taint" )
83
- }
84
-
85
- /**
86
- * Gets the sink model for `api` with `input` and `kind`.
87
- */
88
- bindingset [ input, kind]
89
- private string asSinkModel ( TargetApiSpecific api , string input , string kind ) {
90
- result =
91
- asPartialModel ( api ) + input + ";" //
92
- + kind + ";" //
93
- + "generated"
94
- }
95
-
96
- /**
97
- * Gets the source model for `api` with `output` and `kind`.
98
- */
99
- bindingset [ output, kind]
100
- private string asSourceModel ( TargetApiSpecific api , string output , string kind ) {
101
- result =
102
- asPartialModel ( api ) + output + ";" //
103
- + kind + ";" //
104
- + "generated"
105
- }
106
-
107
64
/**
108
65
* Gets the summary model of `api`, if it follows the `fluent` programming pattern (returns `this`).
109
66
*/
@@ -112,7 +69,7 @@ string captureQualifierFlow(TargetApiSpecific api) {
112
69
api = returnNodeEnclosingCallable ( ret ) and
113
70
isOwnInstanceAccessNode ( ret )
114
71
) and
115
- result = asValueModel ( api , qualifierString ( ) , "ReturnValue" )
72
+ result = ModelPrinting :: asValueModel ( api , qualifierString ( ) , "ReturnValue" )
116
73
}
117
74
118
75
private int accessPathLimit ( ) { result = 2 }
@@ -225,7 +182,7 @@ string captureThroughFlow(DataFlowTargetApi api) {
225
182
input = parameterNodeAsInput ( p ) and
226
183
output = returnNodeAsOutput ( returnNodeExt ) and
227
184
input != output and
228
- result = asTaintModel ( api , input , output )
185
+ result = ModelPrinting :: asTaintModel ( api , input , output )
229
186
)
230
187
}
231
188
@@ -264,7 +221,7 @@ string captureSource(DataFlowTargetApi api) {
264
221
ExternalFlow:: sourceNode ( source , kind ) and
265
222
api = sink .getEnclosingCallable ( ) and
266
223
isRelevantSourceKind ( kind ) and
267
- result = asSourceModel ( api , returnNodeAsOutput ( sink ) , kind )
224
+ result = ModelPrinting :: asSourceModel ( api , returnNodeAsOutput ( sink ) , kind )
268
225
)
269
226
}
270
227
@@ -296,6 +253,6 @@ string captureSink(DataFlowTargetApi api) {
296
253
ExternalFlow:: sinkNode ( sink , kind ) and
297
254
api = src .getEnclosingCallable ( ) and
298
255
isRelevantSinkKind ( kind ) and
299
- result = asSinkModel ( api , asInputArgument ( src ) , kind )
256
+ result = ModelPrinting :: asSinkModel ( api , asInputArgument ( src ) , kind )
300
257
)
301
258
}
0 commit comments