|
33 | 33 | SecurityContentProductName,
|
34 | 34 | SecurityDomain,
|
35 | 35 | )
|
36 |
| -from contentctl.objects.mitre_attack_enrichment import MitreAttackEnrichment, MitreAttackGroup |
| 36 | +from contentctl.objects.mitre_attack_enrichment import ( |
| 37 | + MitreAttackEnrichment, |
| 38 | + MitreAttackGroup, |
| 39 | +) |
37 | 40 |
|
38 | 41 |
|
39 | 42 | class DetectionTags(BaseModel):
|
@@ -68,12 +71,14 @@ def kill_chain_phases(self) -> list[KillChainPhase]:
|
68 | 71 | phases.add(phase)
|
69 | 72 | return sorted(list(phases))
|
70 | 73 |
|
| 74 | + # We do not want this to be included in serialization. By default, @property |
| 75 | + # objects are not included in dumps |
71 | 76 | @property
|
72 |
| - def unique_mitre_attack_groups(self)->list[MitreAttackGroup]: |
| 77 | + def unique_mitre_attack_groups(self) -> list[MitreAttackGroup]: |
73 | 78 | group_set: set[MitreAttackGroup] = set()
|
74 |
| - for enrichment in self.enrichments: |
| 79 | + for enrichment in self.mitre_attack_enrichments: |
75 | 80 | group_set.update(set(enrichment.mitre_attack_group_objects))
|
76 |
| - return sorted(group_set, lambda k: k.group) |
| 81 | + return sorted(group_set, key=lambda k: k.group) |
77 | 82 |
|
78 | 83 | # enum is intentionally Cis18 even though field is named cis20 for legacy reasons
|
79 | 84 | @computed_field
|
@@ -277,3 +282,6 @@ def mapAtomicGuidsToAtomicTests(
|
277 | 282 | return matched_tests + [
|
278 | 283 | AtomicTest.AtomicTestWhenTestIsMissing(test) for test in missing_tests
|
279 | 284 | ]
|
| 285 | + return matched_tests + [ |
| 286 | + AtomicTest.AtomicTestWhenTestIsMissing(test) for test in missing_tests |
| 287 | + ] |
0 commit comments