Skip to content

Conversation

@morsa4406
Copy link
Contributor

No description provided.

@MarshalX MarshalX changed the title CM-31412 [cli] - SCA- fix advisory severity is missing throw exception in sorted detections CM-31412 - Fix severity sorting for unknown severity Jan 17, 2024
MarshalX
MarshalX previously approved these changes Jan 17, 2024
@MarshalX
Copy link
Contributor

as i understand it breaks this code:

def _does_severity_match_severity_threshold(severity: str, severity_threshold: str) -> bool:
detection_severity_value = Severity.try_get_value(severity)
if detection_severity_value is None:
return True
return detection_severity_value >= Severity.try_get_value(severity_threshold)

@MarshalX
Copy link
Contributor

MarshalX commented Jan 17, 2024

ig we can create Severity.get_value (without try) and return -2 if not exists. and leave the existing method without changes

or even get_sort_value/get_member_weight to be more clear. and this method will be used in table printer

@morsa4406 morsa4406 requested a review from MarshalX January 17, 2024 14:49
@morsa4406
Copy link
Contributor Author

as i understand it breaks this code:

def _does_severity_match_severity_threshold(severity: str, severity_threshold: str) -> bool:
detection_severity_value = Severity.try_get_value(severity)
if detection_severity_value is None:
return True
return detection_severity_value >= Severity.try_get_value(severity_threshold)

Fixed

@MarshalX
Copy link
Contributor

ig we can create Severity.get_value (without try) and return -2 if not exists. and leave the existing method without changes

or even get_sort_value/get_member_weight to be more clear. and this method will be used in table printer

@morsa4406 in case you missed this. btw linter failed

@morsa4406 morsa4406 merged commit 19b3227 into main Jan 17, 2024
@morsa4406 morsa4406 deleted the CM-31412-fix-advisory-severity-missing branch January 17, 2024 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants