@@ -116,19 +116,14 @@ def _should_use_sync_flow(scan_type: str, sync_option: bool, scan_parameters: Op
116116
117117
118118def _enrich_scan_result_with_data_from_detection_rules (
119- cycode_client : 'ScanClient' , scan_type : str , scan_result : ZippedFileScanResult
119+ cycode_client : 'ScanClient' , scan_result : ZippedFileScanResult
120120) -> None :
121- # TODO(MarshalX): remove scan_type arg after migration to new backend filter
122- if scan_type not in {consts .SECRET_SCAN_TYPE , consts .INFRA_CONFIGURATION_SCAN_TYPE }:
123- # not yet
124- return
125-
126121 detection_rule_ids = set ()
127122 for detections_per_file in scan_result .detections_per_file :
128123 for detection in detections_per_file .detections :
129124 detection_rule_ids .add (detection .detection_rule_id )
130125
131- detection_rules = cycode_client .get_detection_rules (scan_type , detection_rule_ids )
126+ detection_rules = cycode_client .get_detection_rules (detection_rule_ids )
132127 detection_rules_by_id = {detection_rule .detection_rule_id : detection_rule for detection_rule in detection_rules }
133128
134129 for detections_per_file in scan_result .detections_per_file :
@@ -138,9 +133,9 @@ def _enrich_scan_result_with_data_from_detection_rules(
138133 # we want to make sure that BE returned it. better to not map data instead of failed scan
139134 continue
140135
141- if detection_rule .classification_data :
136+ if not detection . severity and detection_rule .classification_data :
142137 # it's fine to take the first one, because:
143- # - for "secrets" and "iac" there is only one classification rule per detection rule
138+ # - for "secrets" and "iac" there is only one classification rule per- detection rule
144139 # - for "sca" and "sast" we get severity from detection service
145140 detection .severity = detection_rule .classification_data [0 ].severity
146141
@@ -187,7 +182,7 @@ def _scan_batch_thread_func(batch: List[Document]) -> Tuple[str, CliError, Local
187182 should_use_sync_flow ,
188183 )
189184
190- _enrich_scan_result_with_data_from_detection_rules (cycode_client , scan_type , scan_result )
185+ _enrich_scan_result_with_data_from_detection_rules (cycode_client , scan_result )
191186
192187 local_scan_result = create_local_scan_result (
193188 scan_result , batch , command_scan_type , scan_type , severity_threshold
0 commit comments