@@ -116,19 +116,14 @@ def _should_use_sync_flow(scan_type: str, sync_option: bool, scan_parameters: Op
116
116
117
117
118
118
def _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
120
120
) -> 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
-
126
121
detection_rule_ids = set ()
127
122
for detections_per_file in scan_result .detections_per_file :
128
123
for detection in detections_per_file .detections :
129
124
detection_rule_ids .add (detection .detection_rule_id )
130
125
131
- detection_rules = cycode_client .get_detection_rules (scan_type , detection_rule_ids )
126
+ detection_rules = cycode_client .get_detection_rules (detection_rule_ids )
132
127
detection_rules_by_id = {detection_rule .detection_rule_id : detection_rule for detection_rule in detection_rules }
133
128
134
129
for detections_per_file in scan_result .detections_per_file :
@@ -138,9 +133,9 @@ def _enrich_scan_result_with_data_from_detection_rules(
138
133
# we want to make sure that BE returned it. better to not map data instead of failed scan
139
134
continue
140
135
141
- if detection_rule .classification_data :
136
+ if not detection . severity and detection_rule .classification_data :
142
137
# 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
144
139
# - for "sca" and "sast" we get severity from detection service
145
140
detection .severity = detection_rule .classification_data [0 ].severity
146
141
@@ -187,7 +182,7 @@ def _scan_batch_thread_func(batch: List[Document]) -> Tuple[str, CliError, Local
187
182
should_use_sync_flow ,
188
183
)
189
184
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 )
191
186
192
187
local_scan_result = create_local_scan_result (
193
188
scan_result , batch , command_scan_type , scan_type , severity_threshold
0 commit comments