22
22
from contentctl .objects .atomic import AtomicTest
23
23
from contentctl .objects .security_content_object import SecurityContentObject
24
24
from contentctl .objects .data_source import DataSource
25
+ from contentctl .objects .event_source import EventSource
25
26
26
27
from contentctl .enrichments .attack_enrichment import AttackEnrichment
27
28
from contentctl .enrichments .cve_enrichment import CveEnrichment
@@ -57,6 +58,7 @@ class DirectorOutputDto:
57
58
deployments : list [Deployment ]
58
59
ssa_detections : list [SSADetection ]
59
60
data_sources : list [DataSource ]
61
+ event_sources : list [EventSource ]
60
62
name_to_content_map : dict [str , SecurityContentObject ] = field (default_factory = dict )
61
63
uuid_to_content_map : dict [UUID , SecurityContentObject ] = field (default_factory = dict )
62
64
@@ -122,6 +124,7 @@ def execute(self, input_dto: validate) -> None:
122
124
self .createSecurityContent (SecurityContentType .stories )
123
125
self .createSecurityContent (SecurityContentType .baselines )
124
126
self .createSecurityContent (SecurityContentType .investigations )
127
+ self .createSecurityContent (SecurityContentType .event_sources )
125
128
self .createSecurityContent (SecurityContentType .data_sources )
126
129
self .createSecurityContent (SecurityContentType .playbooks )
127
130
self .createSecurityContent (SecurityContentType .detections )
@@ -141,6 +144,21 @@ def createSecurityContent(self, contentType: SecurityContentType) -> None:
141
144
)
142
145
)
143
146
147
+ elif contentType == SecurityContentType .event_sources :
148
+ security_content_files = Utils .get_all_yml_files_from_directory (
149
+ os .path .join (self .input_dto .path , "data_sources" , "cloud" , "event_sources" )
150
+ )
151
+ security_content_files .extend (
152
+ Utils .get_all_yml_files_from_directory (
153
+ os .path .join (self .input_dto .path , "data_sources" , "endpoint" , "event_sources" )
154
+ )
155
+ )
156
+ security_content_files .extend (
157
+ Utils .get_all_yml_files_from_directory (
158
+ os .path .join (self .input_dto .path , "data_sources" , "network" , "event_sources" )
159
+ )
160
+ )
161
+
144
162
elif contentType in [
145
163
SecurityContentType .deployments ,
146
164
SecurityContentType .lookups ,
@@ -183,12 +201,6 @@ def createSecurityContent(self, contentType: SecurityContentType) -> None:
183
201
deployment = Deployment .model_validate (modelDict ,context = {"output_dto" :self .output_dto })
184
202
self .output_dto .addContentToDictMappings (deployment )
185
203
186
- elif contentType == SecurityContentType .data_sources :
187
- data_source = DataSource .model_validate (
188
- modelDict , context = {"output_dto" : self .output_dto }
189
- )
190
- self .output_dto .data_sources .append (data_source )
191
-
192
204
elif contentType == SecurityContentType .playbooks :
193
205
playbook = Playbook .model_validate (modelDict ,context = {"output_dto" :self .output_dto })
194
206
self .output_dto .addContentToDictMappings (playbook )
@@ -214,6 +226,18 @@ def createSecurityContent(self, contentType: SecurityContentType) -> None:
214
226
ssa_detection = self .ssa_detection_builder .getObject ()
215
227
if ssa_detection .status in [DetectionStatus .production .value , DetectionStatus .validation .value ]:
216
228
self .output_dto .addContentToDictMappings (ssa_detection )
229
+
230
+ elif contentType == SecurityContentType .data_sources :
231
+ data_source = DataSource .model_validate (
232
+ modelDict , context = {"output_dto" : self .output_dto }
233
+ )
234
+ self .output_dto .data_sources .append (data_source )
235
+
236
+ elif contentType == SecurityContentType .event_sources :
237
+ event_source = EventSource .model_validate (
238
+ modelDict , context = {"output_dto" : self .output_dto }
239
+ )
240
+ self .output_dto .event_sources .append (event_source )
217
241
218
242
else :
219
243
raise Exception (f"Unsupported type: [{ contentType } ]" )
@@ -262,7 +286,7 @@ def constructSSADetection(
262
286
file_path : str ,
263
287
) -> None :
264
288
builder .reset ()
265
- builder .setObject (file_path , self . output_dto )
289
+ builder .setObject (file_path )
266
290
builder .addMitreAttackEnrichmentNew (directorOutput .attack_enrichment )
267
291
builder .addKillChainPhase ()
268
292
builder .addCIS ()
0 commit comments