From 927eb8424d3b8809326d7a299fd110ebffc10dfc Mon Sep 17 00:00:00 2001 From: Dave Bartolomeo Date: Thu, 26 Oct 2023 13:46:37 -0400 Subject: [PATCH] Update shared/threat-models/codeql/threatmodels/ThreatModels.qll Co-authored-by: Michael Nebel --- .../codeql/threatmodels/ThreatModels.qll | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/shared/threat-models/codeql/threatmodels/ThreatModels.qll b/shared/threat-models/codeql/threatmodels/ThreatModels.qll index c30e08f4653..3b22a12a858 100644 --- a/shared/threat-models/codeql/threatmodels/ThreatModels.qll +++ b/shared/threat-models/codeql/threatmodels/ThreatModels.qll @@ -46,22 +46,21 @@ private string getParentThreatModel(string child) { } /** - * Gets the `enabled` column of the highest-priority configuration row whose `kind` column includes - * the specified threat model kind. + * Holds if the `enabled` column is set to `true` of the highest-priority configuration row + * whose `kind` column includes the specified threat model kind. */ -private boolean threatModelExplicitState(string kind) { +private predicate threatModelEnabled(string kind) { // Find the highest-oriority configuration row whose `kind` column includes the specified threat // model kind. If such a row exists and its `enabled` column is `true`, then the threat model is // enabled. - (knownThreatModel(kind) or kind = "") and - result = - max(boolean enabled, int priority | - exists(string configuredKind | configuredKind = getParentThreatModel*(kind) | - threatModelConfiguration(configuredKind, enabled, priority) - ) - | - enabled order by priority + knownThreatModel(kind) and + max(boolean enabled, int priority | + exists(string configuredKind | configuredKind = getParentThreatModel*(kind) | + threatModelConfiguration(configuredKind, enabled, priority) ) + | + enabled order by priority + ) = true } /**