@@ -35,7 +35,8 @@ newtype TApplicationModeEndpoint =
3535 argExpr .isVararg ( ) and
3636 not exists ( int i | i < idx and call .getArgument ( i ) .( Argument ) .isVararg ( ) )
3737 )
38- }
38+ } or
39+ TMethodCall ( Call call ) { not call instanceof ConstructorCall }
3940
4041/**
4142 * An endpoint is a node that is a candidate for modeling.
@@ -122,6 +123,25 @@ class ImplicitVarargsArray extends ApplicationModeEndpoint, TImplicitVarargsArra
122123 override string toString ( ) { result = vararg .toString ( ) }
123124}
124125
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+
125145/**
126146 * A candidates implementation.
127147 *
@@ -275,6 +295,7 @@ private class UnexploitableIsCharacteristic extends CharacteristicsImpl::NotASin
275295 UnexploitableIsCharacteristic ( ) { this = "unexploitable (is-style boolean method)" }
276296
277297 override predicate appliesToEndpoint ( Endpoint e ) {
298+ e .getExtensibleType ( ) = "sinkModel" and
278299 not ApplicationCandidatesImpl:: isSink ( e , _, _) and
279300 ApplicationModeGetCallable:: getCallable ( e ) .getName ( ) .matches ( "is%" ) and
280301 ApplicationModeGetCallable:: getCallable ( e ) .getReturnType ( ) instanceof BooleanType
@@ -293,6 +314,7 @@ private class UnexploitableExistsCharacteristic extends CharacteristicsImpl::Not
293314 UnexploitableExistsCharacteristic ( ) { this = "unexploitable (existence-checking boolean method)" }
294315
295316 override predicate appliesToEndpoint ( Endpoint e ) {
317+ e .getExtensibleType ( ) = "sinkModel" and
296318 not ApplicationCandidatesImpl:: isSink ( e , _, _) and
297319 exists ( Callable callable |
298320 callable = ApplicationModeGetCallable:: getCallable ( e ) and
@@ -309,6 +331,7 @@ private class ExceptionCharacteristic extends CharacteristicsImpl::NotASinkChara
309331 ExceptionCharacteristic ( ) { this = "exception" }
310332
311333 override predicate appliesToEndpoint ( Endpoint e ) {
334+ e .getExtensibleType ( ) = "sinkModel" and
312335 ApplicationModeGetCallable:: getCallable ( e ) .getDeclaringType ( ) .getASupertype * ( ) instanceof
313336 TypeThrowable
314337 }
@@ -323,9 +346,13 @@ private class IsMaDTaintStepCharacteristic extends CharacteristicsImpl::NotASink
323346 IsMaDTaintStepCharacteristic ( ) { this = "taint step" }
324347
325348 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
329356 FlowSummaryImpl:: Private:: Steps:: summarySetterStep ( e .asNode ( ) , _, _, _)
330357 }
331358}
@@ -340,6 +367,7 @@ private class ArgumentToLocalCall extends CharacteristicsImpl::UninterestingToMo
340367 ArgumentToLocalCall ( ) { this = "argument to local call" }
341368
342369 override predicate appliesToEndpoint ( Endpoint e ) {
370+ e .getExtensibleType ( ) = "sinkModel" and
343371 ApplicationModeGetCallable:: getCallable ( e ) .fromSource ( )
344372 }
345373}
@@ -351,6 +379,7 @@ private class ExcludedFromModeling extends CharacteristicsImpl::UninterestingToM
351379 ExcludedFromModeling ( ) { this = "excluded from modeling" }
352380
353381 override predicate appliesToEndpoint ( Endpoint e ) {
382+ e .getExtensibleType ( ) = "sinkModel" and
354383 ModelExclusions:: isUninterestingForModels ( ApplicationModeGetCallable:: getCallable ( e ) )
355384 }
356385}
@@ -364,6 +393,7 @@ private class NonPublicMethodCharacteristic extends CharacteristicsImpl::Uninter
364393 NonPublicMethodCharacteristic ( ) { this = "non-public method" }
365394
366395 override predicate appliesToEndpoint ( Endpoint e ) {
396+ e .getExtensibleType ( ) = "sinkModel" and
367397 not ApplicationModeGetCallable:: getCallable ( e ) .isPublic ( )
368398 }
369399}
@@ -386,6 +416,7 @@ private class OtherArgumentToModeledMethodCharacteristic extends Characteristics
386416 }
387417
388418 override predicate appliesToEndpoint ( Endpoint e ) {
419+ e .getExtensibleType ( ) = "sinkModel" and
389420 not ApplicationCandidatesImpl:: isSink ( e , _, _) and
390421 exists ( Endpoint otherSink |
391422 ApplicationCandidatesImpl:: isSink ( otherSink , _, "manual" ) and
@@ -403,7 +434,10 @@ private class OtherArgumentToModeledMethodCharacteristic extends Characteristics
403434private class FunctionValueCharacteristic extends CharacteristicsImpl:: LikelyNotASinkCharacteristic {
404435 FunctionValueCharacteristic ( ) { this = "function value" }
405436
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+ }
407441}
408442
409443/**
@@ -419,6 +453,7 @@ private class CannotBeTaintedCharacteristic extends CharacteristicsImpl::LikelyN
419453
420454 override predicate appliesToEndpoint ( Endpoint e ) {
421455 // XXX consider source candidate endpoints
456+ e .getExtensibleType ( ) = "sinkModel" and
422457 not this .isKnownOutNodeForStep ( e )
423458 }
424459
0 commit comments