@@ -174,23 +174,27 @@ def addAttackEnrichments(cls, v:list[MitreAttackEnrichment], info:ValidationInfo
174
174
@field_validator ("mitre_attack_id" , mode = "after" )
175
175
@classmethod
176
176
def sameTypeAndSubtypeNotPresent (
177
- cls , mitre_ids : list [MITRE_ATTACK_ID_TYPE ]
177
+ cls , techniques_and_subtechniques : list [MITRE_ATTACK_ID_TYPE ]
178
178
) -> list [MITRE_ATTACK_ID_TYPE ]:
179
- id_types : list [str ] = [
180
- f"{ mitre_id } ." for mitre_id in mitre_ids if "." not in mitre_id
179
+ techniques : list [str ] = [
180
+ f"{ unknown_technique } ."
181
+ for unknown_technique in techniques_and_subtechniques
182
+ if "." not in unknown_technique
181
183
]
182
- id_subtypes : list [MITRE_ATTACK_ID_TYPE ] = [
183
- mitre_id for mitre_id in mitre_ids if "." in mitre_id
184
+ subtechniques : list [MITRE_ATTACK_ID_TYPE ] = [
185
+ unknown_technique
186
+ for unknown_technique in techniques_and_subtechniques
187
+ if "." in unknown_technique
184
188
]
185
189
subtype_and_parent_exist_exceptions : list [ValueError ] = []
186
190
187
- for id_subtype in id_subtypes :
188
- for id_type in id_types :
189
- if id_subtype .startswith (id_type ):
191
+ for subtechnique in subtechniques :
192
+ for technique in techniques :
193
+ if subtechnique .startswith (technique ):
190
194
subtype_and_parent_exist_exceptions .append (
191
195
ValueError (
192
- f" Tactic : { id_type .split ('.' )[0 ]} \n "
193
- f" Subtactic : { id_subtype } \n "
196
+ f" Technique : { technique .split ('.' )[0 ]} \n "
197
+ f" SubTechnique : { subtechnique } \n "
194
198
)
195
199
)
196
200
@@ -199,11 +203,11 @@ def sameTypeAndSubtypeNotPresent(
199
203
str (e ) for e in subtype_and_parent_exist_exceptions
200
204
)
201
205
raise ValueError (
202
- "Overlapping MITRE Attack ID Tactics and Subtactics may not be defined. "
203
- f"Remove the tactic and keep the subtactic :\n { error_string } "
206
+ "Overlapping MITRE Attack ID Techniques and Subtechniques may not be defined. "
207
+ f"Remove the Technique and keep the Subtechnique :\n { error_string } "
204
208
)
205
209
206
- return mitre_ids
210
+ return techniques_and_subtechniques
207
211
208
212
@field_validator ("analytic_story" , mode = "before" )
209
213
@classmethod
0 commit comments