Fine tune logic for sorting by severity
Problem to solve
On the project dependency list, vulnerability severities are sorted. The logic of the sort is shown in the following examples:
Example 1 - Sort by critical severity vulnerabilities first
- 10 critical, 5 high, and X other
- 5 critical, 10 high, and X other
Example 2 - Even though there are more high severity vulnerabilities, still sort by critical severity vulnerabilities first
- 1 critical, 5 high, and X other
- 0 critical, 20 high, and X other
Example 3 - If there are no critical vulnerabilities, sort by high severity vulnerabilities next
- 0 critical, 25 high, and X other
- 0 critical, 20 high, and X other
Example 4 - Even though there are more vulnerabilities with severities that are less severe than high, still sort by high severity first
- 0 critical, 25 high, and 25 other
- 0 critical, 0 high, and 30 other
Example 5 - If there are no critical and high severity vulnerabilities, look at the count for the remaining vulnerabilities.
- 0 critical, 0 high, and 15 other
- 0 critical, 0 high, and 2 other
All of the logic is great except: Example 6
- 1 critical, 0 high, and x other
- 1 critical, 1 high, and x other
The sort order for Example 6 should be:
- 1 critical, 1 high, and x other
- 1 critical, 0 high, and x other
for ascending sort by severity.