@@ -47,9 +47,11 @@ abstract class Sanitizer extends DataFlow::Node { }
47
47
private class RemoteSource extends Source instanceof RemoteFlowSource { }
48
48
49
49
/**
50
+ * DEPRECATED: Use `TaintToObjectMethodTracking` instead.
51
+ *
50
52
* User input to object method call deserialization flow tracking.
51
53
*/
52
- class TaintToObjectMethodTrackingConfig extends TaintTracking:: Configuration {
54
+ deprecated class TaintToObjectMethodTrackingConfig extends TaintTracking:: Configuration {
53
55
TaintToObjectMethodTrackingConfig ( ) { this = "TaintToObjectMethodTrackingConfig" }
54
56
55
57
override predicate isSource ( DataFlow:: Node source ) { source instanceof Source }
@@ -60,9 +62,27 @@ class TaintToObjectMethodTrackingConfig extends TaintTracking::Configuration {
60
62
}
61
63
62
64
/**
65
+ * User input to object method call deserialization flow tracking configuration.
66
+ */
67
+ private module TaintToObjectMethodTrackingConfig implements DataFlow:: ConfigSig {
68
+ predicate isSource ( DataFlow:: Node source ) { source instanceof Source }
69
+
70
+ predicate isSink ( DataFlow:: Node sink ) { sink instanceof InstanceMethodSink }
71
+
72
+ predicate isBarrier ( DataFlow:: Node node ) { node instanceof Sanitizer }
73
+ }
74
+
75
+ /**
76
+ * User input to object method call deserialization flow tracking module.
77
+ */
78
+ module TaintToObjectMethodTracking = TaintTracking:: Global< TaintToObjectMethodTrackingConfig > ;
79
+
80
+ /**
81
+ * DEPRECATED: Use `JsonConvertTracking` instead.
82
+ *
63
83
* User input to `JsonConvert` call deserialization flow tracking.
64
84
*/
65
- class JsonConvertTrackingConfig extends TaintTracking:: Configuration {
85
+ deprecated class JsonConvertTrackingConfig extends TaintTracking:: Configuration {
66
86
JsonConvertTrackingConfig ( ) { this = "JsonConvertTrackingConfig" }
67
87
68
88
override predicate isSource ( DataFlow:: Node source ) { source instanceof Source }
@@ -74,6 +94,24 @@ class JsonConvertTrackingConfig extends TaintTracking::Configuration {
74
94
override predicate isSanitizer ( DataFlow:: Node node ) { node instanceof Sanitizer }
75
95
}
76
96
97
+ /**
98
+ * User input to `JsonConvert` call deserialization flow tracking configuration.
99
+ */
100
+ private module JsonConvertTrackingConfig implements DataFlow:: ConfigSig {
101
+ predicate isSource ( DataFlow:: Node source ) { source instanceof Source }
102
+
103
+ predicate isSink ( DataFlow:: Node sink ) {
104
+ sink instanceof NewtonsoftJsonConvertDeserializeObjectMethodSink
105
+ }
106
+
107
+ predicate isBarrier ( DataFlow:: Node node ) { node instanceof Sanitizer }
108
+ }
109
+
110
+ /**
111
+ * User input to `JsonConvert` call deserialization flow tracking module.
112
+ */
113
+ module JsonConvertTracking = TaintTracking:: Global< JsonConvertTrackingConfig > ;
114
+
77
115
/**
78
116
* DEPRECATED: Use `TypeNameTracking` instead.
79
117
*
@@ -186,9 +224,12 @@ private module TypeNameTrackingConfig implements DataFlow::ConfigSig {
186
224
module TypeNameTracking = DataFlow:: Global< TypeNameTrackingConfig > ;
187
225
188
226
/**
227
+ * DEPRECATED: Use `TaintToConstructorOrStaticMethodTracking` instead.
228
+ *
189
229
* User input to static method or constructor call deserialization flow tracking.
190
230
*/
191
- class TaintToConstructorOrStaticMethodTrackingConfig extends TaintTracking:: Configuration {
231
+ deprecated class TaintToConstructorOrStaticMethodTrackingConfig extends TaintTracking:: Configuration
232
+ {
192
233
TaintToConstructorOrStaticMethodTrackingConfig ( ) {
193
234
this = "TaintToConstructorOrStaticMethodTrackingConfig"
194
235
}
@@ -201,9 +242,28 @@ class TaintToConstructorOrStaticMethodTrackingConfig extends TaintTracking::Conf
201
242
}
202
243
203
244
/**
245
+ * User input to static method or constructor call deserialization flow tracking configuration.
246
+ */
247
+ private module TaintToConstructorOrStaticMethodTrackingConfig implements DataFlow:: ConfigSig {
248
+ predicate isSource ( DataFlow:: Node source ) { source instanceof Source }
249
+
250
+ predicate isSink ( DataFlow:: Node sink ) { sink instanceof ConstructorOrStaticMethodSink }
251
+
252
+ predicate isBarrier ( DataFlow:: Node node ) { node instanceof Sanitizer }
253
+ }
254
+
255
+ /**
256
+ * User input to static method or constructor call deserialization flow tracking module.
257
+ */
258
+ module TaintToConstructorOrStaticMethodTracking =
259
+ TaintTracking:: Global< TaintToConstructorOrStaticMethodTrackingConfig > ;
260
+
261
+ /**
262
+ * DEPRECATED: Use `TaintToObjectTypeTracking` instead.
263
+ *
204
264
* User input to instance type flow tracking.
205
265
*/
206
- class TaintToObjectTypeTrackingConfig extends TaintTracking2:: Configuration {
266
+ deprecated class TaintToObjectTypeTrackingConfig extends TaintTracking2:: Configuration {
207
267
TaintToObjectTypeTrackingConfig ( ) { this = "TaintToObjectTypeTrackingConfig" }
208
268
209
269
override predicate isSource ( DataFlow:: Node source ) { source instanceof Source }
@@ -234,9 +294,47 @@ class TaintToObjectTypeTrackingConfig extends TaintTracking2::Configuration {
234
294
}
235
295
236
296
/**
297
+ * User input to instance type flow tracking config.
298
+ */
299
+ private module TaintToObjectTypeTrackingConfig implements DataFlow:: ConfigSig {
300
+ predicate isSource ( DataFlow:: Node source ) { source instanceof Source }
301
+
302
+ predicate isSink ( DataFlow:: Node sink ) {
303
+ exists ( MethodCall mc |
304
+ mc .getTarget ( ) instanceof UnsafeDeserializer and
305
+ sink .asExpr ( ) = mc .getQualifier ( )
306
+ )
307
+ }
308
+
309
+ predicate isAdditionalFlowStep ( DataFlow:: Node n1 , DataFlow:: Node n2 ) {
310
+ exists ( MethodCall mc , Method m |
311
+ m = mc .getTarget ( ) and
312
+ m .getDeclaringType ( ) .hasQualifiedName ( "System" , "Type" ) and
313
+ m .hasName ( "GetType" ) and
314
+ m .isStatic ( ) and
315
+ n1 .asExpr ( ) = mc .getArgument ( 0 ) and
316
+ n2 .asExpr ( ) = mc
317
+ )
318
+ or
319
+ exists ( ObjectCreation oc |
320
+ n1 .asExpr ( ) = oc .getAnArgument ( ) and
321
+ n2 .asExpr ( ) = oc and
322
+ oc .getObjectType ( ) instanceof StrongTypeDeserializer
323
+ )
324
+ }
325
+ }
326
+
327
+ /**
328
+ * User input to instance type flow tracking module.
329
+ */
330
+ module TaintToObjectTypeTracking = TaintTracking:: Global< TaintToObjectTypeTrackingConfig > ;
331
+
332
+ /**
333
+ * DEPRECATED: Use `WeakTypeCreationToUsageTracking` instead.
334
+ *
237
335
* Unsafe deserializer creation to usage tracking config.
238
336
*/
239
- class WeakTypeCreationToUsageTrackingConfig extends TaintTracking2:: Configuration {
337
+ deprecated class WeakTypeCreationToUsageTrackingConfig extends TaintTracking2:: Configuration {
240
338
WeakTypeCreationToUsageTrackingConfig ( ) { this = "DeserializerCreationToUsageTrackingConfig" }
241
339
242
340
override predicate isSource ( DataFlow:: Node source ) {
@@ -254,6 +352,31 @@ class WeakTypeCreationToUsageTrackingConfig extends TaintTracking2::Configuratio
254
352
}
255
353
}
256
354
355
+ /**
356
+ * Unsafe deserializer creation to usage tracking config.
357
+ */
358
+ private module WeakTypeCreationToUsageTrackingConfig implements DataFlow:: ConfigSig {
359
+ predicate isSource ( DataFlow:: Node source ) {
360
+ exists ( ObjectCreation oc |
361
+ oc .getObjectType ( ) instanceof WeakTypeDeserializer and
362
+ source .asExpr ( ) = oc
363
+ )
364
+ }
365
+
366
+ predicate isSink ( DataFlow:: Node sink ) {
367
+ exists ( MethodCall mc |
368
+ mc .getTarget ( ) instanceof UnsafeDeserializer and
369
+ sink .asExpr ( ) = mc .getQualifier ( )
370
+ )
371
+ }
372
+ }
373
+
374
+ /**
375
+ * Unsafe deserializer creation to usage tracking module.
376
+ */
377
+ module WeakTypeCreationToUsageTracking =
378
+ TaintTracking:: Global< WeakTypeCreationToUsageTrackingConfig > ;
379
+
257
380
/**
258
381
* Safe deserializer creation to usage tracking config.
259
382
*/
0 commit comments