Skip to content

Commit 0745169

Browse files
committed
fix typing issue and add property decorator
so that new field is not serialized
1 parent 458861d commit 0745169

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

contentctl/objects/detection_tags.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@
3333
SecurityContentProductName,
3434
SecurityDomain,
3535
)
36-
from contentctl.objects.mitre_attack_enrichment import MitreAttackEnrichment, MitreAttackGroup
36+
from contentctl.objects.mitre_attack_enrichment import (
37+
MitreAttackEnrichment,
38+
MitreAttackGroup,
39+
)
3740

3841

3942
class DetectionTags(BaseModel):
@@ -68,12 +71,14 @@ def kill_chain_phases(self) -> list[KillChainPhase]:
6871
phases.add(phase)
6972
return sorted(list(phases))
7073

74+
# We do not want this to be included in serialization. By default, @property
75+
# objects are not included in dumps
7176
@property
72-
def unique_mitre_attack_groups(self)->list[MitreAttackGroup]:
77+
def unique_mitre_attack_groups(self) -> list[MitreAttackGroup]:
7378
group_set: set[MitreAttackGroup] = set()
74-
for enrichment in self.enrichments:
79+
for enrichment in self.mitre_attack_enrichments:
7580
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)
7782

7883
# enum is intentionally Cis18 even though field is named cis20 for legacy reasons
7984
@computed_field
@@ -277,3 +282,6 @@ def mapAtomicGuidsToAtomicTests(
277282
return matched_tests + [
278283
AtomicTest.AtomicTestWhenTestIsMissing(test) for test in missing_tests
279284
]
285+
return matched_tests + [
286+
AtomicTest.AtomicTestWhenTestIsMissing(test) for test in missing_tests
287+
]

0 commit comments

Comments
 (0)