@@ -365,6 +365,16 @@ def _data_handler(self, json_data) -> None:
365365 event_data = json_data ["event" ]
366366 entity_id = event_data .get ("entity_id" )
367367 entity_type = event_data .get ("entity_type" )
368+ stix_entity = (
369+ json .loads (event_data .get ("stix_entity" ))
370+ if event_data .get ("stix_entity" )
371+ else None
372+ )
373+ stix_objects = (
374+ json .loads (event_data .get ("stix_objects" ))
375+ if event_data .get ("stix_objects" )
376+ else None
377+ )
368378 validation_mode = event_data .get ("validation_mode" , "workbench" )
369379 force_validation = event_data .get ("force_validation" , False )
370380 # Set the API headers
@@ -430,17 +440,18 @@ def _data_handler(self, json_data) -> None:
430440 else :
431441 # If not playbook but enrichment, compute object on enrichment_entity
432442 opencti_entity = event_data ["enrichment_entity" ]
433- stix_objects = self .helper .api .stix2 .prepare_export (
434- entity = self .helper .api .stix2 .generate_export (
435- copy .copy (opencti_entity )
443+ if stix_objects is None :
444+ stix_objects = self .helper .api .stix2 .prepare_export (
445+ entity = self .helper .api .stix2 .generate_export (
446+ copy .copy (opencti_entity )
447+ )
436448 )
437- )
438- stix_entity = [
439- e
440- for e in stix_objects
441- if e ["id" ] == opencti_entity ["standard_id" ]
442- or e ["id" ] == "x-opencti-" + opencti_entity ["standard_id" ]
443- ][0 ]
449+ stix_entity = [
450+ e
451+ for e in stix_objects
452+ if e ["id" ] == opencti_entity ["standard_id" ]
453+ or e ["id" ] == "x-opencti-" + opencti_entity ["standard_id" ]
454+ ][0 ]
444455 event_data ["stix_objects" ] = stix_objects
445456 event_data ["stix_entity" ] = stix_entity
446457 # Handle organization propagation
@@ -1116,6 +1127,15 @@ def __init__(self, config: Dict, playbook_compatible=False) -> None:
11161127 self .connect_auto = get_config_variable (
11171128 "CONNECTOR_AUTO" , ["connector" , "auto" ], config , default = False
11181129 )
1130+ self .connect_auto_update = get_config_variable (
1131+ "CONNECTOR_AUTO_UPDATE" , ["connector" , "auto_update" ], config , default = False
1132+ )
1133+ self .connect_enrichment_resolution = get_config_variable (
1134+ "CONNECTOR_ENRICHMENT_RESOLUTION" ,
1135+ ["connector" , "enrichment_resolution" ],
1136+ config ,
1137+ default = "none" ,
1138+ )
11191139 self .bundle_send_to_queue = get_config_variable (
11201140 "CONNECTOR_SEND_TO_QUEUE" ,
11211141 ["connector" , "send_to_queue" ],
@@ -1231,14 +1251,16 @@ def __init__(self, config: Dict, playbook_compatible=False) -> None:
12311251 )
12321252 # Register the connector in OpenCTI
12331253 self .connector = OpenCTIConnector (
1234- self .connect_id ,
1235- self .connect_name ,
1236- self .connect_type ,
1237- self .connect_scope ,
1238- self .connect_auto ,
1239- self .connect_only_contextual ,
1240- playbook_compatible ,
1241- (
1254+ connector_id = self .connect_id ,
1255+ connector_name = self .connect_name ,
1256+ connector_type = self .connect_type ,
1257+ scope = self .connect_scope ,
1258+ auto = self .connect_auto ,
1259+ only_contextual = self .connect_only_contextual ,
1260+ playbook_compatible = playbook_compatible ,
1261+ auto_update = self .connect_auto_update ,
1262+ enrichment_resolution = self .connect_enrichment_resolution ,
1263+ listen_callback_uri = (
12421264 self .listen_protocol_api_uri + self .listen_protocol_api_path
12431265 if self .listen_protocol == "API"
12441266 else None
0 commit comments