fix(heatmap): hide empty tactics in threat-actor layer
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled

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.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
kitos
2026-06-04 17:23:28 +02:00
parent 019924f78c
commit 15eda30b75

View File

@@ -259,7 +259,11 @@ def build_threat_actor_layer(
if is_actor_technique and score < min_score: if is_actor_technique and score < min_score:
continue 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) tc = test_counts.get(tech.id, 0)
rc = rule_counts.get(tech.mitre_id, 0) rc = rule_counts.get(tech.mitre_id, 0)
metadata = [ metadata = [
@@ -279,16 +283,6 @@ def build_threat_actor_layer(
"enabled": True, "enabled": True,
"metadata": metadata, "metadata": metadata,
}) })
else:
layer["techniques"].append({
"techniqueID": tech.mitre_id,
"tactic": _format_tactic(tech.tactic),
"color": "",
"score": 0,
"comment": "",
"enabled": False,
"metadata": [],
})
return layer return layer