mirror of
https://github.com/github/codeql.git
synced 2026-04-20 22:44:52 +02:00
Some more performance refactoring.
This commit is contained in:
@@ -40,13 +40,11 @@ Endpoint getSampleForCharacteristic(EndpointCharacteristic c, int limit) {
|
||||
)
|
||||
}
|
||||
|
||||
from
|
||||
Endpoint endpoint, EndpointCharacteristic characteristic, float confidence, string message,
|
||||
ApplicationModeMetadataExtractor meta, DollarAtString package, DollarAtString type,
|
||||
DollarAtString subtypes, DollarAtString name, DollarAtString signature, DollarAtString input,
|
||||
DollarAtString output, DollarAtString isVarargsArray, DollarAtString extensibleType
|
||||
where
|
||||
endpoint = getSampleForCharacteristic(characteristic, 100) and
|
||||
predicate candidate(
|
||||
Endpoint endpoint, EndpointCharacteristic characteristic, float confidence, string package,
|
||||
string type, string subtypes, string name, string signature, string input, string output,
|
||||
string isVarargsArray, string extensibleType
|
||||
) {
|
||||
// the node is know not to be an endpoint of any appropriate type
|
||||
forall(EndpointType tp | tp = endpoint.getAPotentialType() |
|
||||
characteristic.hasImplications(tp, false, _)
|
||||
@@ -54,15 +52,27 @@ where
|
||||
// the lowest confidence across all endpoint types should be at least highConfidence
|
||||
confidence = min(float c | characteristic.hasImplications(endpoint.getAPotentialType(), false, c)) and
|
||||
confidence >= SharedCharacteristics::highConfidence() and
|
||||
meta.hasMetadata(endpoint, package, type, subtypes, name, signature, input, output,
|
||||
isVarargsArray, _, extensibleType) and
|
||||
any(ApplicationModeMetadataExtractor meta)
|
||||
.hasMetadata(endpoint, package, type, subtypes, name, signature, input, output,
|
||||
isVarargsArray, _, extensibleType) and
|
||||
// It's valid for a node to be both a potential source/sanitizer and a sink. We don't want to include such nodes
|
||||
// as negative examples in the prompt, because they're ambiguous and might confuse the model, so we explicitly them here.
|
||||
not exists(EndpointCharacteristic characteristic2, float confidence2, EndpointType type2 |
|
||||
characteristic2.appliesToEndpoint(endpoint) and
|
||||
confidence2 >= SharedCharacteristics::maximalConfidence() and
|
||||
characteristic2.hasImplications(type2, true, confidence2)
|
||||
) and
|
||||
)
|
||||
}
|
||||
|
||||
from
|
||||
Endpoint endpoint, EndpointCharacteristic characteristic, float confidence, string message,
|
||||
DollarAtString package, DollarAtString type, DollarAtString subtypes, DollarAtString name,
|
||||
DollarAtString signature, DollarAtString input, DollarAtString output,
|
||||
DollarAtString isVarargsArray, DollarAtString extensibleType
|
||||
where
|
||||
endpoint = getSampleForCharacteristic(characteristic, 100) and
|
||||
candidate(endpoint, characteristic, confidence, package, type, subtypes, name, signature, input,
|
||||
output, isVarargsArray, extensibleType) and
|
||||
message = characteristic
|
||||
select endpoint.asNode(),
|
||||
message + "\nrelated locations: $@, $@, $@." + "\nmetadata: $@, $@, $@, $@, $@, $@, $@, $@, $@.", //
|
||||
|
||||
Reference in New Issue
Block a user