28
28
from contentctl .enrichments .cve_enrichment import CveEnrichment
29
29
30
30
from contentctl .objects .config import validate
31
- from contentctl .input .ssa_detection_builder import SSADetectionBuilder
32
31
from contentctl .objects .enums import SecurityContentType
33
32
34
33
from contentctl .objects .enums import DetectionStatus
35
34
from contentctl .helper .utils import Utils
36
35
37
- from contentctl .input .ssa_detection_builder import SSADetectionBuilder
38
36
from contentctl .objects .enums import SecurityContentType
39
37
40
38
from contentctl .objects .enums import DetectionStatus
@@ -56,7 +54,6 @@ class DirectorOutputDto:
56
54
macros : list [Macro ]
57
55
lookups : list [Lookup ]
58
56
deployments : list [Deployment ]
59
- ssa_detections : list [SSADetection ]
60
57
data_sources : list [DataSource ]
61
58
name_to_content_map : dict [str , SecurityContentObject ] = field (default_factory = dict )
62
59
uuid_to_content_map : dict [UUID , SecurityContentObject ] = field (default_factory = dict )
@@ -98,8 +95,6 @@ def addContentToDictMappings(self, content: SecurityContentObject):
98
95
self .stories .append (content )
99
96
elif isinstance (content , Detection ):
100
97
self .detections .append (content )
101
- elif isinstance (content , SSADetection ):
102
- self .ssa_detections .append (content )
103
98
elif isinstance (content , DataSource ):
104
99
self .data_sources .append (content )
105
100
else :
@@ -112,11 +107,9 @@ def addContentToDictMappings(self, content: SecurityContentObject):
112
107
class Director ():
113
108
input_dto : validate
114
109
output_dto : DirectorOutputDto
115
- ssa_detection_builder : SSADetectionBuilder
116
110
117
111
def __init__ (self , output_dto : DirectorOutputDto ) -> None :
118
112
self .output_dto = output_dto
119
- self .ssa_detection_builder = SSADetectionBuilder ()
120
113
121
114
def execute (self , input_dto : validate ) -> None :
122
115
self .input_dto = input_dto
@@ -129,7 +122,6 @@ def execute(self, input_dto: validate) -> None:
129
122
self .createSecurityContent (SecurityContentType .data_sources )
130
123
self .createSecurityContent (SecurityContentType .playbooks )
131
124
self .createSecurityContent (SecurityContentType .detections )
132
- self .createSecurityContent (SecurityContentType .ssa_detections )
133
125
134
126
135
127
from contentctl .objects .abstract_security_content_objects .detection_abstract import MISSING_SOURCES
@@ -142,12 +134,7 @@ def execute(self, input_dto: validate) -> None:
142
134
print ("No missing data_sources!" )
143
135
144
136
def createSecurityContent (self , contentType : SecurityContentType ) -> None :
145
- if contentType == SecurityContentType .ssa_detections :
146
- files = Utils .get_all_yml_files_from_directory (
147
- os .path .join (self .input_dto .path , "ssa_detections" )
148
- )
149
- security_content_files = [f for f in files if f .name .startswith ("ssa___" )]
150
- elif contentType in [
137
+ if contentType in [
151
138
SecurityContentType .deployments ,
152
139
SecurityContentType .lookups ,
153
140
SecurityContentType .macros ,
@@ -179,43 +166,37 @@ def createSecurityContent(self, contentType: SecurityContentType) -> None:
179
166
modelDict = YmlReader .load_file (file )
180
167
181
168
if contentType == SecurityContentType .lookups :
182
- lookup = Lookup .model_validate (modelDict ,context = {"output_dto" :self .output_dto , "config" :self .input_dto })
169
+ lookup = Lookup .model_validate (modelDict , context = {"output_dto" :self .output_dto , "config" :self .input_dto })
183
170
self .output_dto .addContentToDictMappings (lookup )
184
171
185
172
elif contentType == SecurityContentType .macros :
186
- macro = Macro .model_validate (modelDict ,context = {"output_dto" :self .output_dto })
173
+ macro = Macro .model_validate (modelDict , context = {"output_dto" :self .output_dto })
187
174
self .output_dto .addContentToDictMappings (macro )
188
175
189
176
elif contentType == SecurityContentType .deployments :
190
- deployment = Deployment .model_validate (modelDict ,context = {"output_dto" :self .output_dto })
177
+ deployment = Deployment .model_validate (modelDict , context = {"output_dto" :self .output_dto })
191
178
self .output_dto .addContentToDictMappings (deployment )
192
179
193
180
elif contentType == SecurityContentType .playbooks :
194
- playbook = Playbook .model_validate (modelDict ,context = {"output_dto" :self .output_dto })
181
+ playbook = Playbook .model_validate (modelDict , context = {"output_dto" :self .output_dto })
195
182
self .output_dto .addContentToDictMappings (playbook )
196
183
197
184
elif contentType == SecurityContentType .baselines :
198
- baseline = Baseline .model_validate (modelDict ,context = {"output_dto" :self .output_dto })
185
+ baseline = Baseline .model_validate (modelDict , context = {"output_dto" :self .output_dto })
199
186
self .output_dto .addContentToDictMappings (baseline )
200
187
201
188
elif contentType == SecurityContentType .investigations :
202
- investigation = Investigation .model_validate (modelDict ,context = {"output_dto" :self .output_dto })
189
+ investigation = Investigation .model_validate (modelDict , context = {"output_dto" :self .output_dto })
203
190
self .output_dto .addContentToDictMappings (investigation )
204
191
205
192
elif contentType == SecurityContentType .stories :
206
- story = Story .model_validate (modelDict ,context = {"output_dto" :self .output_dto })
193
+ story = Story .model_validate (modelDict , context = {"output_dto" :self .output_dto })
207
194
self .output_dto .addContentToDictMappings (story )
208
195
209
196
elif contentType == SecurityContentType .detections :
210
- detection = Detection .model_validate (modelDict ,context = {"output_dto" :self .output_dto , "app" :self .input_dto .app })
197
+ detection = Detection .model_validate (modelDict , context = {"output_dto" :self .output_dto , "app" :self .input_dto .app })
211
198
self .output_dto .addContentToDictMappings (detection )
212
199
213
- elif contentType == SecurityContentType .ssa_detections :
214
- self .constructSSADetection (self .ssa_detection_builder , self .output_dto ,str (file ))
215
- ssa_detection = self .ssa_detection_builder .getObject ()
216
- if ssa_detection .status in [DetectionStatus .production .value , DetectionStatus .validation .value ]:
217
- self .output_dto .addContentToDictMappings (ssa_detection )
218
-
219
200
elif contentType == SecurityContentType .data_sources :
220
201
data_source = DataSource .model_validate (
221
202
modelDict , context = {"output_dto" : self .output_dto }
@@ -262,19 +243,3 @@ def createSecurityContent(self, contentType: SecurityContentType) -> None:
262
243
f"The following { len (validation_errors )} error(s) were found during validation:\n \n { errors_string } \n \n VALIDATION FAILED"
263
244
)
264
245
265
- def constructSSADetection (
266
- self ,
267
- builder : SSADetectionBuilder ,
268
- directorOutput : DirectorOutputDto ,
269
- file_path : str ,
270
- ) -> None :
271
- builder .reset ()
272
- builder .setObject (file_path )
273
- builder .addMitreAttackEnrichmentNew (directorOutput .attack_enrichment )
274
- builder .addKillChainPhase ()
275
- builder .addCIS ()
276
- builder .addNist ()
277
- builder .addAnnotations ()
278
- builder .addMappings ()
279
- builder .addUnitTest ()
280
- builder .addRBA ()
0 commit comments