From d7094a96b5810a977549ea59940041bfef8db3c6 Mon Sep 17 00:00:00 2001 From: Kasper Svendsen Date: Fri, 4 Jul 2025 13:12:23 +0200 Subject: [PATCH] Overlay: Add discarding of all Java base properties --- java/ql/lib/semmle/code/java/Overlay.qll | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/java/ql/lib/semmle/code/java/Overlay.qll b/java/ql/lib/semmle/code/java/Overlay.qll index f1cfc5c434f..be218e0e78e 100644 --- a/java/ql/lib/semmle/code/java/Overlay.qll +++ b/java/ql/lib/semmle/code/java/Overlay.qll @@ -81,3 +81,21 @@ private predicate discardReferableLocatable(@locatable el) { not drl.existsInOverlay() ) } + +overlay[local] +private predicate baseConfigLocatable(@configLocatable l) { not isOverlay() and l = l } + +overlay[local] +private predicate overlayHasConfigLocatables() { + isOverlay() and + exists(@configLocatable el) +} + +overlay[discard_entity] +private predicate discardBaseConfigLocatable(@configLocatable el) { + // The properties extractor is currently not incremental, so if + // the overlay contains any config locatables, the overlay should + // contain a full extraction and all config locatables from base + // should be discarded. + baseConfigLocatable(el) and overlayHasConfigLocatables() +}