Improve positive prompt examples:

Include only sinks that are arguments to an external API call, because these are the sinks we are most interested in.
This commit is contained in:
tiferet
2023-02-16 16:42:57 -08:00
parent 4db03cf4ae
commit abe3a2dae1

View File

@@ -9,6 +9,7 @@
private import java
import semmle.code.java.dataflow.TaintTracking
private import semmle.code.java.security.ExternalAPIs as ExternalAPIs
private import experimental.adaptivethreatmodeling.EndpointCharacteristics as EndpointCharacteristics
private import experimental.adaptivethreatmodeling.EndpointTypes
private import experimental.adaptivethreatmodeling.ATMConfig as AtmConfig
@@ -34,6 +35,9 @@ where
// treated by the actual query as a sanitizer, since the final logic is something like
// `isSink(n) and not isSanitizer(n)`. We don't want to include such nodes as positive examples in the prompt.
not config.isSanitizer(sink) and
// Include only sinks that are arguments to an external API call, because these are the sinks we are most interested
// in.
sink instanceof ExternalAPIs::ExternalApiDataNode and
message =
sinkType.getDescription() + "\n" +
// Extract the needed metadata for this endpoint.