From fc8c7c875bb00495674bf099b6cb345924f0f5f1 Mon Sep 17 00:00:00 2001 From: Anders Starcke Henriksen Date: Tue, 1 Aug 2023 10:15:22 +0200 Subject: [PATCH] Change from package to endpoint. --- ...tomodelApplicationModeExtractCandidates.ql | 2 +- ...AutomodelFrameworkModeExtractCandidates.ql | 2 +- java/ql/src/Telemetry/AutomodelJavaUtil.qll | 20 ++++++++++--------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/java/ql/src/Telemetry/AutomodelApplicationModeExtractCandidates.ql b/java/ql/src/Telemetry/AutomodelApplicationModeExtractCandidates.ql index e8eed47dbd41a..49d594dfdefb8 100644 --- a/java/ql/src/Telemetry/AutomodelApplicationModeExtractCandidates.ql +++ b/java/ql/src/Telemetry/AutomodelApplicationModeExtractCandidates.ql @@ -66,7 +66,7 @@ where // modeled in a MaD model, then it doesn't belong to any additional sink types, and we don't need to reexamine it. not CharacteristicsImpl::isSink(endpoint, _, _) and meta.hasMetadata(endpoint, package, type, subtypes, name, signature, input) and - automodelCandidateFilter(package) and + includeAutomodelCandidate(package, type, name, signature) and // The message is the concatenation of all sink types for which this endpoint is known neither to be a sink nor to be // a non-sink, and we surface only endpoints that have at least one such sink type. message = diff --git a/java/ql/src/Telemetry/AutomodelFrameworkModeExtractCandidates.ql b/java/ql/src/Telemetry/AutomodelFrameworkModeExtractCandidates.ql index 34c4fe711a3b2..028a27a9bdca4 100644 --- a/java/ql/src/Telemetry/AutomodelFrameworkModeExtractCandidates.ql +++ b/java/ql/src/Telemetry/AutomodelFrameworkModeExtractCandidates.ql @@ -30,7 +30,7 @@ where // modeled in a MaD model, then it doesn't belong to any additional sink types, and we don't need to reexamine it. not CharacteristicsImpl::isSink(endpoint, _, _) and meta.hasMetadata(endpoint, package, type, subtypes, name, signature, input, parameterName) and - automodelCandidateFilter(package) and + includeAutomodelCandidate(package, type, name, signature) and // The message is the concatenation of all sink types for which this endpoint is known neither to be a sink nor to be // a non-sink, and we surface only endpoints that have at least one such sink type. message = diff --git a/java/ql/src/Telemetry/AutomodelJavaUtil.qll b/java/ql/src/Telemetry/AutomodelJavaUtil.qll index 0c51b27383d29..a224fc291a2ca 100644 --- a/java/ql/src/Telemetry/AutomodelJavaUtil.qll +++ b/java/ql/src/Telemetry/AutomodelJavaUtil.qll @@ -68,20 +68,22 @@ boolean considerSubtypes(Callable callable) { } /** - * Holds if the given package is a candidate for automodeling. + * Holds if the given package, type, name and signature is a candidate for automodeling. * - * This predicate is extensible, so that different packages can be selected at runtime. + * This predicate is extensible, so that different endpoints can be selected at runtime. */ -extensible predicate automodelCandidatePackageFilter(string package); +extensible predicate automodelCandidateFilter( + string package, string type, string name, string signature +); /** - * Holds if the given package is a candidate for automodeling. + * Holds if the given package, type, name and signature is a candidate for automodeling. * * This relies on an extensible predicate, and if that is not supplied then - * all packages are considered candidates. + * all endpoints are considered candidates. */ -bindingset[package] -predicate automodelCandidateFilter(string package) { - not automodelCandidatePackageFilter(_) or - automodelCandidatePackageFilter(package) +bindingset[package, type, name, signature] +predicate includeAutomodelCandidate(string package, string type, string name, string signature) { + not automodelCandidateFilter(_, _, _, _) or + automodelCandidateFilter(package, type, name, signature) }