cve-report: Add summary counts of CVEs by recipe
PATCH 1/1 cve-report: Add summary counts of CVEs by recipe
It is often helpful to know how many CVEs are open against a given recipe. Add a summary table of this to the end of the CVE listing.
Signed-off-by Richard Purdie <[email protected]>
--- scripts/cve-report.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
scripts/cve-report.py +14 -0
@@ -12,6 +12,7 @@ with open(jsonfile) as f: cvedata = json.load(f) cves = dict() +recipe_counts = {} for recipe in cvedata['package']: if recipe['name'] in ignored_recipes:
@@ -28,3 +29,16 @@ for recipe in cvedata['package']: print("Found %d unpatched CVEs" % len(cves)) for cve in sorted(cves.keys()): print("%s: %s https://web.nvd.nist.gov/view/vuln/detail?vulnId=%s *" % (cve, cves[cve], cve)) + +for cve in cves: + recipename = cves[cve] + if recipename in recipe_counts: + recipe_counts[recipename] += 1 + else: + recipe_counts[recipename] = 1 + + +print("\n") +print("Summary of CVE counts by recipes:\n") +for recipe, count in sorted(recipe_counts.items(), key=lambda x: x[1], reverse=True): + print(" %s: %s" % (recipe, count))
Signature · 1 line
2.40.1