@@ -35,7 +35,8 @@ newtype TApplicationModeEndpoint =
35
35
argExpr .isVararg ( ) and
36
36
not exists ( int i | i < idx and call .getArgument ( i ) .( Argument ) .isVararg ( ) )
37
37
)
38
- }
38
+ } or
39
+ TMethodCall ( Call call ) { not call instanceof ConstructorCall }
39
40
40
41
/**
41
42
* An endpoint is a node that is a candidate for modeling.
@@ -122,6 +123,25 @@ class ImplicitVarargsArray extends ApplicationModeEndpoint, TImplicitVarargsArra
122
123
override string toString ( ) { result = vararg .toString ( ) }
123
124
}
124
125
126
+ /**
127
+ * An endpoint that represents a method call.
128
+ */
129
+ class MethodCall extends ApplicationModeEndpoint , TMethodCall {
130
+ Call call ;
131
+
132
+ MethodCall ( ) { this = TMethodCall ( call ) }
133
+
134
+ override predicate isArgOf ( Call c , int idx ) { c = call and idx = - 1 }
135
+
136
+ override Top asTop ( ) { result = call }
137
+
138
+ override DataFlow:: Node asNode ( ) { result .asExpr ( ) = call }
139
+
140
+ override string getExtensibleType ( ) { result = "sourceModel" }
141
+
142
+ override string toString ( ) { result = call .toString ( ) }
143
+ }
144
+
125
145
/**
126
146
* A candidates implementation.
127
147
*
@@ -275,6 +295,7 @@ private class UnexploitableIsCharacteristic extends CharacteristicsImpl::NotASin
275
295
UnexploitableIsCharacteristic ( ) { this = "unexploitable (is-style boolean method)" }
276
296
277
297
override predicate appliesToEndpoint ( Endpoint e ) {
298
+ e .getExtensibleType ( ) = "sinkModel" and
278
299
not ApplicationCandidatesImpl:: isSink ( e , _, _) and
279
300
ApplicationModeGetCallable:: getCallable ( e ) .getName ( ) .matches ( "is%" ) and
280
301
ApplicationModeGetCallable:: getCallable ( e ) .getReturnType ( ) instanceof BooleanType
@@ -293,6 +314,7 @@ private class UnexploitableExistsCharacteristic extends CharacteristicsImpl::Not
293
314
UnexploitableExistsCharacteristic ( ) { this = "unexploitable (existence-checking boolean method)" }
294
315
295
316
override predicate appliesToEndpoint ( Endpoint e ) {
317
+ e .getExtensibleType ( ) = "sinkModel" and
296
318
not ApplicationCandidatesImpl:: isSink ( e , _, _) and
297
319
exists ( Callable callable |
298
320
callable = ApplicationModeGetCallable:: getCallable ( e ) and
@@ -309,6 +331,7 @@ private class ExceptionCharacteristic extends CharacteristicsImpl::NotASinkChara
309
331
ExceptionCharacteristic ( ) { this = "exception" }
310
332
311
333
override predicate appliesToEndpoint ( Endpoint e ) {
334
+ e .getExtensibleType ( ) = "sinkModel" and
312
335
ApplicationModeGetCallable:: getCallable ( e ) .getDeclaringType ( ) .getASupertype * ( ) instanceof
313
336
TypeThrowable
314
337
}
@@ -323,9 +346,13 @@ private class IsMaDTaintStepCharacteristic extends CharacteristicsImpl::NotASink
323
346
IsMaDTaintStepCharacteristic ( ) { this = "taint step" }
324
347
325
348
override predicate appliesToEndpoint ( Endpoint e ) {
326
- FlowSummaryImpl:: Private:: Steps:: summaryThroughStepValue ( e .asNode ( ) , _, _) or
327
- FlowSummaryImpl:: Private:: Steps:: summaryThroughStepTaint ( e .asNode ( ) , _, _) or
328
- FlowSummaryImpl:: Private:: Steps:: summaryGetterStep ( e .asNode ( ) , _, _, _) or
349
+ e .getExtensibleType ( ) = "sinkModel" and
350
+ FlowSummaryImpl:: Private:: Steps:: summaryThroughStepValue ( e .asNode ( ) , _, _)
351
+ or
352
+ FlowSummaryImpl:: Private:: Steps:: summaryThroughStepTaint ( e .asNode ( ) , _, _)
353
+ or
354
+ FlowSummaryImpl:: Private:: Steps:: summaryGetterStep ( e .asNode ( ) , _, _, _)
355
+ or
329
356
FlowSummaryImpl:: Private:: Steps:: summarySetterStep ( e .asNode ( ) , _, _, _)
330
357
}
331
358
}
@@ -340,6 +367,7 @@ private class ArgumentToLocalCall extends CharacteristicsImpl::UninterestingToMo
340
367
ArgumentToLocalCall ( ) { this = "argument to local call" }
341
368
342
369
override predicate appliesToEndpoint ( Endpoint e ) {
370
+ e .getExtensibleType ( ) = "sinkModel" and
343
371
ApplicationModeGetCallable:: getCallable ( e ) .fromSource ( )
344
372
}
345
373
}
@@ -351,6 +379,7 @@ private class ExcludedFromModeling extends CharacteristicsImpl::UninterestingToM
351
379
ExcludedFromModeling ( ) { this = "excluded from modeling" }
352
380
353
381
override predicate appliesToEndpoint ( Endpoint e ) {
382
+ e .getExtensibleType ( ) = "sinkModel" and
354
383
ModelExclusions:: isUninterestingForModels ( ApplicationModeGetCallable:: getCallable ( e ) )
355
384
}
356
385
}
@@ -364,6 +393,7 @@ private class NonPublicMethodCharacteristic extends CharacteristicsImpl::Uninter
364
393
NonPublicMethodCharacteristic ( ) { this = "non-public method" }
365
394
366
395
override predicate appliesToEndpoint ( Endpoint e ) {
396
+ e .getExtensibleType ( ) = "sinkModel" and
367
397
not ApplicationModeGetCallable:: getCallable ( e ) .isPublic ( )
368
398
}
369
399
}
@@ -386,6 +416,7 @@ private class OtherArgumentToModeledMethodCharacteristic extends Characteristics
386
416
}
387
417
388
418
override predicate appliesToEndpoint ( Endpoint e ) {
419
+ e .getExtensibleType ( ) = "sinkModel" and
389
420
not ApplicationCandidatesImpl:: isSink ( e , _, _) and
390
421
exists ( Endpoint otherSink |
391
422
ApplicationCandidatesImpl:: isSink ( otherSink , _, "manual" ) and
@@ -403,7 +434,10 @@ private class OtherArgumentToModeledMethodCharacteristic extends Characteristics
403
434
private class FunctionValueCharacteristic extends CharacteristicsImpl:: LikelyNotASinkCharacteristic {
404
435
FunctionValueCharacteristic ( ) { this = "function value" }
405
436
406
- override predicate appliesToEndpoint ( Endpoint e ) { e .asNode ( ) .asExpr ( ) instanceof FunctionalExpr }
437
+ override predicate appliesToEndpoint ( Endpoint e ) {
438
+ e .getExtensibleType ( ) = "sinkModel" and
439
+ e .asNode ( ) .asExpr ( ) instanceof FunctionalExpr
440
+ }
407
441
}
408
442
409
443
/**
@@ -419,6 +453,7 @@ private class CannotBeTaintedCharacteristic extends CharacteristicsImpl::LikelyN
419
453
420
454
override predicate appliesToEndpoint ( Endpoint e ) {
421
455
// XXX consider source candidate endpoints
456
+ e .getExtensibleType ( ) = "sinkModel" and
422
457
not this .isKnownOutNodeForStep ( e )
423
458
}
424
459
0 commit comments