@@ -67,13 +67,13 @@ module ApplicationCandidatesImpl implements SharedCharacteristics::CandidateSig
6767
6868 predicate isKnownKind = AutomodelJavaUtil:: isKnownKind / 2 ;
6969
70- predicate isSink ( Endpoint e , string kind ) {
70+ predicate isSink ( Endpoint e , string kind , string provenance ) {
7171 exists ( string package , string type , string name , string signature , string ext , string input |
7272 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 )
7474 )
7575 or
76- isCustomSink ( e , kind )
76+ isCustomSink ( e , kind ) and provenance = "custom-sink"
7777 }
7878
7979 predicate isNeutral ( Endpoint e ) {
@@ -200,7 +200,7 @@ private class UnexploitableIsCharacteristic extends CharacteristicsImpl::NotASin
200200 UnexploitableIsCharacteristic ( ) { this = "unexploitable (is-style boolean method)" }
201201
202202 override predicate appliesToEndpoint ( Endpoint e ) {
203- not ApplicationCandidatesImpl:: isSink ( e , _) and
203+ not ApplicationCandidatesImpl:: isSink ( e , _, _ ) and
204204 ApplicationModeGetCallable:: getCallable ( e ) .getName ( ) .matches ( "is%" ) and
205205 ApplicationModeGetCallable:: getCallable ( e ) .getReturnType ( ) instanceof BooleanType
206206 }
@@ -218,7 +218,7 @@ private class UnexploitableExistsCharacteristic extends CharacteristicsImpl::Not
218218 UnexploitableExistsCharacteristic ( ) { this = "unexploitable (existence-checking boolean method)" }
219219
220220 override predicate appliesToEndpoint ( Endpoint e ) {
221- not ApplicationCandidatesImpl:: isSink ( e , _) and
221+ not ApplicationCandidatesImpl:: isSink ( e , _, _ ) and
222222 exists ( Callable callable |
223223 callable = ApplicationModeGetCallable:: getCallable ( e ) and
224224 callable .getName ( ) .toLowerCase ( ) = [ "exists" , "notexists" ] and
@@ -313,7 +313,8 @@ private class NonPublicMethodCharacteristic extends CharacteristicsImpl::Uninter
313313
314314/**
315315 * 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.
317318 *
318319 * WARNING: These endpoints should not be used as negative samples for training, because some sinks may have been missed
319320 * 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
324325private class OtherArgumentToModeledMethodCharacteristic extends CharacteristicsImpl:: LikelyNotASinkCharacteristic
325326{
326327 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 "
328329 }
329330
330331 override predicate appliesToEndpoint ( Endpoint e ) {
331- not ApplicationCandidatesImpl:: isSink ( e , _) and
332+ not ApplicationCandidatesImpl:: isSink ( e , _, _ ) and
332333 exists ( DataFlow:: Node otherSink , Call c |
333- ApplicationCandidatesImpl:: isSink ( otherSink , _) and
334+ ApplicationCandidatesImpl:: isSink ( otherSink , _, "manual" ) and
334335 c = otherSink .asExpr ( ) .( Argument ) .getCall ( ) and
335336 e .asExpr ( ) in [ c .getQualifier ( ) , c .getAnArgument ( ) ] and
336337 e != otherSink
0 commit comments