Skip to content

Commit

Permalink
fixup! Fix: Inspector reports should link to CVEs (#6557)
Browse files Browse the repository at this point in the history
  • Loading branch information
achave11-ucsc committed Sep 21, 2024
1 parent b22ba9e commit e2e5569
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/export_inspector_findings.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,11 @@ def findings_sort(self, item: tuple[str, list[SummaryType]]) -> tuple[int, str]:
if vulnerability.startswith('CVE-'):
# Best secondary-sorting effort on CVE findings, vulnerability names
# not prefixed with 'CVE' may reflect an inaccurate secondary order.
id = vulnerability.split('-')[-1]
padded_id = '000000'[:abs(6 - len(id))] + id
vulnerability = vulnerability.replace(id, padded_id)
id = vulnerability.rsplit('-', 1)[1]
id_max_length = 6
if len(id) > id_max_length:
log.warning('Vulnerability %s may not be sorted properly', vulnerability)
vulnerability = vulnerability.replace(id, f'{id:0>6}')
return score, vulnerability

def write_to_csv(self, findings: dict[str, list[SummaryType]]) -> None:
Expand Down

0 comments on commit e2e5569

Please sign in to comment.