@@ -40,29 +40,39 @@ Endpoint getSampleForCharacteristic(EndpointCharacteristic c, int limit) {
40
40
)
41
41
}
42
42
43
- from
44
- Endpoint endpoint , EndpointCharacteristic characteristic , float confidence , string message ,
45
- ApplicationModeMetadataExtractor meta , DollarAtString package , DollarAtString type ,
46
- DollarAtString subtypes , DollarAtString name , DollarAtString signature , DollarAtString input ,
47
- DollarAtString output , DollarAtString isVarargsArray , DollarAtString extensibleType
48
- where
49
- endpoint = getSampleForCharacteristic ( characteristic , 100 ) and
43
+ predicate candidate (
44
+ Endpoint endpoint , EndpointCharacteristic characteristic , float confidence , string package ,
45
+ string type , string subtypes , string name , string signature , string input , string output ,
46
+ string isVarargsArray , string extensibleType
47
+ ) {
50
48
// the node is know not to be an endpoint of any appropriate type
51
49
forall ( EndpointType tp | tp = endpoint .getAPotentialType ( ) |
52
50
characteristic .hasImplications ( tp , false , _)
53
51
) and
54
52
// the lowest confidence across all endpoint types should be at least highConfidence
55
53
confidence = min ( float c | characteristic .hasImplications ( endpoint .getAPotentialType ( ) , false , c ) ) and
56
54
confidence >= SharedCharacteristics:: highConfidence ( ) and
57
- meta .hasMetadata ( endpoint , package , type , subtypes , name , signature , input , output ,
58
- isVarargsArray , _, extensibleType ) and
55
+ any ( ApplicationModeMetadataExtractor meta )
56
+ .hasMetadata ( endpoint , package , type , subtypes , name , signature , input , output ,
57
+ isVarargsArray , _, extensibleType ) and
59
58
// It's valid for a node to be both a potential source/sanitizer and a sink. We don't want to include such nodes
60
59
// as negative examples in the prompt, because they're ambiguous and might confuse the model, so we explicitly them here.
61
60
not exists ( EndpointCharacteristic characteristic2 , float confidence2 , EndpointType type2 |
62
61
characteristic2 .appliesToEndpoint ( endpoint ) and
63
62
confidence2 >= SharedCharacteristics:: maximalConfidence ( ) and
64
63
characteristic2 .hasImplications ( type2 , true , confidence2 )
65
- ) and
64
+ )
65
+ }
66
+
67
+ from
68
+ Endpoint endpoint , EndpointCharacteristic characteristic , float confidence , string message ,
69
+ DollarAtString package , DollarAtString type , DollarAtString subtypes , DollarAtString name ,
70
+ DollarAtString signature , DollarAtString input , DollarAtString output ,
71
+ DollarAtString isVarargsArray , DollarAtString extensibleType
72
+ where
73
+ endpoint = getSampleForCharacteristic ( characteristic , 100 ) and
74
+ candidate ( endpoint , characteristic , confidence , package , type , subtypes , name , signature , input ,
75
+ output , isVarargsArray , extensibleType ) and
66
76
message = characteristic
67
77
select endpoint .asNode ( ) ,
68
78
message + "\nrelated locations: $@, $@, $@." + "\nmetadata: $@, $@, $@, $@, $@, $@, $@, $@, $@." , //
0 commit comments