C#/Java: Don't generate models if there exist a manual summary or neutral summary.

This commit is contained in:
Michael Nebel
2023-12-20 15:18:42 +01:00
parent 87c6a3e38c
commit 81de9d35af
5 changed files with 13 additions and 23 deletions

View File

@@ -5,6 +5,7 @@
private import java as J
private import semmle.code.java.dataflow.internal.DataFlowPrivate
private import semmle.code.java.dataflow.internal.ContainerFlow as ContainerFlow
private import semmle.code.java.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
private import semmle.code.java.dataflow.internal.ModelExclusions
private import semmle.code.java.dataflow.DataFlow as Df
private import semmle.code.java.dataflow.SSA as Ssa
@@ -37,7 +38,11 @@ private predicate isInfrequentlyUsed(J::CompilationUnit cu) {
*/
private predicate isRelevantForModels(J::Callable api) {
not isUninterestingForModels(api) and
not isInfrequentlyUsed(api.getCompilationUnit())
not isInfrequentlyUsed(api.getCompilationUnit()) and
// Disregard all APIs that have a manual model.
not api = any(FlowSummaryImpl::Public::SummarizedCallable sc | sc.applyManualModel()).asCallable() and
not api =
any(FlowSummaryImpl::Public::NeutralSummaryCallable sc | sc.hasManualModel()).asCallable()
}
/**