@@ -17,7 +17,7 @@ private import semmle.code.java.dataflow.internal.ModelExclusions as ModelExclus
1717import AutomodelSharedCharacteristics as SharedCharacteristics
1818import AutomodelEndpointTypes as AutomodelEndpointTypes
1919
20- module CandidatesImpl implements SharedCharacteristics:: CandidateSig {
20+ module FrameworkCandidatesImpl implements SharedCharacteristics:: CandidateSig {
2121 class Endpoint = DataFlow:: ParameterNode ;
2222
2323 class EndpointType = AutomodelEndpointTypes:: EndpointType ;
@@ -29,7 +29,7 @@ module CandidatesImpl implements SharedCharacteristics::CandidateSig {
2929 // Sanitizers are currently not modeled in MaD. TODO: check if this has large negative impact.
3030 predicate isSanitizer ( Endpoint e , EndpointType t ) { none ( ) }
3131
32- RelatedLocation toRelatedLocation ( Endpoint e ) { result = e .asParameter ( ) }
32+ RelatedLocation asLocation ( Endpoint e ) { result = e .asParameter ( ) }
3333
3434 predicate isKnownLabel ( string label , string humanReadableLabel , EndpointType type ) {
3535 label = "read-file" and
@@ -89,18 +89,11 @@ module CandidatesImpl implements SharedCharacteristics::CandidateSig {
8989
9090 predicate hasMetadata ( Endpoint e , string metadata ) {
9191 exists (
92- string package , string type , boolean subtypes , string name , string signature , string ext ,
93- int input , boolean isPublic , boolean isFinal , boolean isStatic
92+ string package , string type , boolean subtypes , string name , string signature , int input ,
93+ boolean isPublic , boolean isFinal , boolean isStatic
9494 |
9595 hasMetadata ( e , package , type , name , signature , input , isFinal , isStatic , isPublic ) and
9696 ( if isFinal = true or isStatic = true then subtypes = false else subtypes = true ) and
97- ext = "" and
98- /*
99- * "ext" will always be empty for automodeling; it's a mechanism for
100- * specifying that the model should apply for parameters that have
101- * a certain annotation.
102- */
103-
10497 metadata =
10598 "{" //
10699 + "'Package': '" + package //
@@ -125,11 +118,11 @@ module CandidatesImpl implements SharedCharacteristics::CandidateSig {
125118
126119Callable getCallable ( Endpoint e ) { result = e .getEnclosingCallable ( ) }
127120
128- module CharacteristicsImpl = SharedCharacteristics:: SharedCharacteristics< CandidatesImpl > ;
121+ module CharacteristicsImpl = SharedCharacteristics:: SharedCharacteristics< FrameworkCandidatesImpl > ;
129122
130123class EndpointCharacteristic = CharacteristicsImpl:: EndpointCharacteristic ;
131124
132- class Endpoint = CandidatesImpl :: Endpoint ;
125+ class Endpoint = FrameworkCandidatesImpl :: Endpoint ;
133126
134127/*
135128 * Predicates that are used to surface prompt examples and candidates for classification with an ML model.
@@ -181,7 +174,7 @@ private class UnexploitableIsCharacteristic extends CharacteristicsImpl::NotASin
181174 UnexploitableIsCharacteristic ( ) { this = "unexploitable (is-style boolean method)" }
182175
183176 override predicate appliesToEndpoint ( Endpoint e ) {
184- not CandidatesImpl :: isSink ( e , _) and
177+ not FrameworkCandidatesImpl :: isSink ( e , _) and
185178 getCallable ( e ) .getName ( ) .matches ( "is%" ) and
186179 getCallable ( e ) .getReturnType ( ) instanceof BooleanType
187180 }
@@ -199,7 +192,7 @@ private class UnexploitableExistsCharacteristic extends CharacteristicsImpl::Not
199192 UnexploitableExistsCharacteristic ( ) { this = "unexploitable (existence-checking boolean method)" }
200193
201194 override predicate appliesToEndpoint ( Endpoint e ) {
202- not CandidatesImpl :: isSink ( e , _) and
195+ not FrameworkCandidatesImpl :: isSink ( e , _) and
203196 exists ( Callable callable |
204197 callable = getCallable ( e ) and
205198 (
0 commit comments