Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Commit

Permalink
Fix affect sorting with no CVE ID attached
Browse files Browse the repository at this point in the history
  • Loading branch information
JakubFrejlach committed Sep 22, 2023
1 parent ebb18b1 commit b727ed5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions griffon/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -916,8 +916,9 @@ def text_output_component_flaws(ctx, output, format, no_wrap=False):
ordered_components = sorted(output["results"], key=lambda d: d["name"])
for item in ordered_components:
component_name = item["name"]
# sorting should work when there is no title or cve-id key
ordered_affects = sorted(item["affects"], key=lambda d: d["flaw_cve_id"])
ordered_affects = sorted(
item["affects"], key=lambda d: (d["flaw_cve_id"] is None, d["flaw_cve_id"])
)
for affect in ordered_affects:
flaw_cve_id = "Vulnerability"
if affect["flaw_cve_id"]:
Expand Down

0 comments on commit b727ed5

Please sign in to comment.