fix(backend): sprint 3 post-review — nullable migration + dead code + tactic names

- Migration 0003: enforce techniques NOT NULL via batch_alter_table
- Migration 0003: remove unused _sims table proxy and dead column/table imports
- mitre.py: add _TACTIC_NAMES dict to fix 'Command And Control' → 'Command and Control'
This commit is contained in:
Knacky
2026-05-27 04:25:20 +02:00
parent 39f4076a81
commit 4596f09e71
2 changed files with 19 additions and 13 deletions

View File

@@ -26,6 +26,21 @@ _TACTIC_ORDER = [
"impact",
]
_TACTIC_NAMES: dict[str, str] = {
"initial-access": "Initial Access",
"execution": "Execution",
"persistence": "Persistence",
"privilege-escalation": "Privilege Escalation",
"defense-evasion": "Defense Evasion",
"credential-access": "Credential Access",
"discovery": "Discovery",
"lateral-movement": "Lateral Movement",
"collection": "Collection",
"command-and-control": "Command and Control",
"exfiltration": "Exfiltration",
"impact": "Impact",
}
mitre_loaded: bool = False
_index: list[dict[str, Any]] = []
_tactics_by_technique: dict[str, list[str]] = {}
@@ -87,7 +102,7 @@ def _build_matrix(entries: list[dict[str, Any]]) -> list[dict[str, Any]]:
techs = tactic_techs.get(tactic_id, [])
# Sort techniques alphabetically.
techs_sorted = sorted(techs, key=lambda x: x["name"])
tactic_name = tactic_id.replace("-", " ").title()
tactic_name = _TACTIC_NAMES.get(tactic_id, tactic_id.replace("-", " ").title())
matrix.append(
{
"tactic_id": tactic_id,