fix(heatmap): hide empty tactics in threat-actor layer

build_threat_actor_layer was adding ALL techniques to the layer —
actor techniques with their real score and non-actor techniques with
score=0/enabled=False. This caused every tactic column to appear in
the matrix even when the actor has no techniques for that tactic.

Now only actor techniques are included. The frontend already filters
visible tactics to those with data, so empty tactic columns disappear
automatically.
This commit is contained in:
kitos
2026-06-04 17:23:28 +02:00
parent 564eb406aa
commit 725cf3406e
+5 -11
View File
@@ -259,7 +259,11 @@ def build_threat_actor_layer(
if is_actor_technique and score < min_score:
continue
if is_actor_technique:
# Only include techniques actually used by this actor — skip the rest
# so that tactics with no actor techniques are hidden in the matrix.
if not is_actor_technique:
continue
tc = test_counts.get(tech.id, 0)
rc = rule_counts.get(tech.mitre_id, 0)
metadata = [
@@ -279,16 +283,6 @@ def build_threat_actor_layer(
"enabled": True,
"metadata": metadata,
})
else:
layer["techniques"].append({
"techniqueID": tech.mitre_id,
"tactic": _format_tactic(tech.tactic),
"color": "",
"score": 0,
"comment": "",
"enabled": False,
"metadata": [],
})
return layer