Skip to content

Commit 67fb610

Browse files
committed
CM-46426 - Fix severity for SCA (use Cycode severity instead of Advisory Severity)
1 parent 27ca863 commit 67fb610

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

cycode/cli/commands/scan/code_scanner.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -695,9 +695,7 @@ def exclude_irrelevant_detections(
695695
def _exclude_detections_by_severity(detections: List[Detection], severity_threshold: str) -> List[Detection]:
696696
relevant_detections = []
697697
for detection in detections:
698-
severity = detection.detection_details.get('advisory_severity')
699-
if not severity:
700-
severity = detection.severity
698+
severity = detection.severity
701699

702700
if _does_severity_match_severity_threshold(severity, severity_threshold):
703701
relevant_detections.append(detection)

cycode/cli/printers/tables/sca_table_printer.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@ def __group_by(detections: List[Detection], details_field_name: str) -> Dict[str
7272

7373
@staticmethod
7474
def __severity_sort_key(detection: Detection) -> int:
75-
severity = detection.detection_details.get('advisory_severity')
76-
if severity:
77-
return Severity.get_member_weight(severity)
75+
if detection.severity:
76+
return Severity.get_member_weight(detection.severity)
7877

7978
return SEVERITY_UNKNOWN_WEIGHT
8079

@@ -138,7 +137,7 @@ def _get_table(self, policy_id: str) -> Table:
138137
def _enrich_table_with_values(table: Table, detection: Detection) -> None:
139138
detection_details = detection.detection_details
140139

141-
table.set(SEVERITY_COLUMN, detection_details.get('advisory_severity'))
140+
table.set(SEVERITY_COLUMN, detection.severity)
142141
table.set(REPOSITORY_COLUMN, detection_details.get('repository_name'))
143142

144143
table.set(CODE_PROJECT_COLUMN, detection_details.get('file_name'))

0 commit comments

Comments
 (0)