feat(d3fend): flag review_required on new ATT&CK-D3FEND mappings

Mirrors the existing Atomic/Caldera/Elastic/Sigma/LOLBAS import pattern —
D3FEND mapping import was the one source silently skipping the
review_required flag, so leads never got prompted to review techniques
that only gained new D3FEND coverage.
This commit is contained in:
kitos
2026-07-07 16:20:01 +02:00
parent b6da0e22c2
commit c234fd64c2
2 changed files with 50 additions and 0 deletions
@@ -583,6 +583,8 @@ def import_d3fend_mappings(db: Session) -> dict[str, int]:
created = 0
# Assign skipped = 0
skipped = 0
# Assign new_technique_ids = set()
new_technique_ids: set[str] = set()
# Get all ATT&CK techniques from the DB
attack_techniques = db.query(Technique).all()
@@ -649,6 +651,12 @@ def import_d3fend_mappings(db: Session) -> dict[str, int]:
db.add(mapping)
# Assign created = 1
created += 1
new_technique_ids.add(mitre_id)
if new_technique_ids:
db.query(Technique).filter(
Technique.mitre_id.in_(new_technique_ids)
).update({"review_required": True}, synchronize_session=False)
# Commit all pending changes to the database
db.commit()