Add option to filter automodel queries by package.

This commit is contained in:
Anders Starcke Henriksen 2023-07-31 09:58:54 +02:00
Родитель 89aa86a1d6
Коммит 9b8d7df370
5 изменённых файлов: 27 добавлений и 0 удалений

Просмотреть файл

@ -66,6 +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
// 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 =

Просмотреть файл

@ -0,0 +1,5 @@
extensions:
- addsTo:
pack: codeql/java-queries
extensible: automodelCandidatePackageFilter
data: []

Просмотреть файл

@ -30,6 +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
// 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 =

Просмотреть файл

@ -66,3 +66,22 @@ boolean considerSubtypes(Callable callable) {
then result = false
else result = true
}
/**
* Holds if the given package is a candidate for automodeling.
*
* This predicate is extensible, so that different packages can be selected at runtime.
*/
extensible predicate automodelCandidatePackageFilter(string package);
/**
* Holds if the given package is a candidate for automodeling.
*
* This relies on an extensible predicate, and if that is not supplied then
* all packages are considered candidates.
*/
bindingset[package]
predicate automodelCandidateFilter(string package) {
not automodelCandidatePackageFilter(_) or
automodelCandidatePackageFilter(package)
}

Просмотреть файл

@ -12,4 +12,5 @@ dependencies:
codeql/util: ${workspace}
dataExtensions:
- Telemetry/ExtractorInformation.yml
- Telemetry/AutomodelCandidateFilter.yml
warnOnImplicitThis: true