@@ -67,13 +67,13 @@ module ApplicationCandidatesImpl implements SharedCharacteristics::CandidateSig
67
67
68
68
predicate isKnownKind = AutomodelJavaUtil:: isKnownKind / 2 ;
69
69
70
- predicate isSink ( Endpoint e , string kind ) {
70
+ predicate isSink ( Endpoint e , string kind , string provenance ) {
71
71
exists ( string package , string type , string name , string signature , string ext , string input |
72
72
sinkSpec ( e , package , type , name , signature , ext , input ) and
73
- ExternalFlow:: sinkModel ( package , type , _, name , [ signature , "" ] , ext , input , kind , _ )
73
+ ExternalFlow:: sinkModel ( package , type , _, name , [ signature , "" ] , ext , input , kind , provenance )
74
74
)
75
75
or
76
- isCustomSink ( e , kind )
76
+ isCustomSink ( e , kind ) and provenance = "custom-sink"
77
77
}
78
78
79
79
predicate isNeutral ( Endpoint e ) {
@@ -200,7 +200,7 @@ private class UnexploitableIsCharacteristic extends CharacteristicsImpl::NotASin
200
200
UnexploitableIsCharacteristic ( ) { this = "unexploitable (is-style boolean method)" }
201
201
202
202
override predicate appliesToEndpoint ( Endpoint e ) {
203
- not ApplicationCandidatesImpl:: isSink ( e , _) and
203
+ not ApplicationCandidatesImpl:: isSink ( e , _, _ ) and
204
204
ApplicationModeGetCallable:: getCallable ( e ) .getName ( ) .matches ( "is%" ) and
205
205
ApplicationModeGetCallable:: getCallable ( e ) .getReturnType ( ) instanceof BooleanType
206
206
}
@@ -218,7 +218,7 @@ private class UnexploitableExistsCharacteristic extends CharacteristicsImpl::Not
218
218
UnexploitableExistsCharacteristic ( ) { this = "unexploitable (existence-checking boolean method)" }
219
219
220
220
override predicate appliesToEndpoint ( Endpoint e ) {
221
- not ApplicationCandidatesImpl:: isSink ( e , _) and
221
+ not ApplicationCandidatesImpl:: isSink ( e , _, _ ) and
222
222
exists ( Callable callable |
223
223
callable = ApplicationModeGetCallable:: getCallable ( e ) and
224
224
callable .getName ( ) .toLowerCase ( ) = [ "exists" , "notexists" ] and
@@ -313,7 +313,8 @@ private class NonPublicMethodCharacteristic extends CharacteristicsImpl::Uninter
313
313
314
314
/**
315
315
* A negative characteristic that indicates that an endpoint is a non-sink argument to a method whose sinks have already
316
- * been modeled.
316
+ * been modeled _manually_. This is restricted to manual sinks only, because only during the manual process do we have
317
+ * the expectation that all sinks present in a method have been considered.
317
318
*
318
319
* WARNING: These endpoints should not be used as negative samples for training, because some sinks may have been missed
319
320
* when the method was modeled. Specifically, as we start using ATM to merge in new declarations, we can be less sure
@@ -324,13 +325,13 @@ private class NonPublicMethodCharacteristic extends CharacteristicsImpl::Uninter
324
325
private class OtherArgumentToModeledMethodCharacteristic extends CharacteristicsImpl:: LikelyNotASinkCharacteristic
325
326
{
326
327
OtherArgumentToModeledMethodCharacteristic ( ) {
327
- this = "other argument to a method that has already been modeled"
328
+ this = "other argument to a method that has already been modeled manually "
328
329
}
329
330
330
331
override predicate appliesToEndpoint ( Endpoint e ) {
331
- not ApplicationCandidatesImpl:: isSink ( e , _) and
332
+ not ApplicationCandidatesImpl:: isSink ( e , _, _ ) and
332
333
exists ( DataFlow:: Node otherSink , Call c |
333
- ApplicationCandidatesImpl:: isSink ( otherSink , _) and
334
+ ApplicationCandidatesImpl:: isSink ( otherSink , _, "manual" ) and
334
335
c = otherSink .asExpr ( ) .( Argument ) .getCall ( ) and
335
336
e .asExpr ( ) in [ c .getQualifier ( ) , c .getAnArgument ( ) ] and
336
337
e != otherSink
0 commit comments