Skip to content

Commit

Permalink
t
Browse files Browse the repository at this point in the history
  • Loading branch information
pna-nca committed May 6, 2024
1 parent 961e05b commit c3f009d
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions dojo/tools/neuvector/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,33 +127,34 @@ def get_item(vulnerability, test):


def get_asset_item(vulnerability, test):
# there is nothing like short description, short name or title
title = vulnerability.get("name").upper()

severity = (
convert_severity(vulnerability.get("severity"))
if "severity" in vulnerability
else "Info"
)

description = vulnerability.get("description", "")
description = vulnerability.get("description", "").strip()

mitigation = ""

package_names = []

packages = vulnerability.get("packages", {})
if len(packages.values()) > 0:
mitigation += "update the affected packages to the following:\n"
description += "\nThe following packages are affected:\n"
mitigation += "<p>update the affected packages to the following versions:</p>"
description += "<p>The following packages are affected:</p>"

for package_name, package_versions in packages.items():
mitigation += "{name}:\n".format(name=package_name)
package_names.append(package_name.split('/')[0])

mitigation += "<p>{name}:</p>".format(name=package_name)

description += "{name}:\n".format(name=package_name)
description += "<p>{name}:</p>".format(name=package_name)
for versions in package_versions:
mitigation += " {fixed}\n".format(fixed=versions.get("fixed_version", "unknown"))
mitigation += "<p> {fixed}</p>".format(fixed=versions.get("fixed_version", "unknown"))

description += " installed version: {installed}\n".format(installed=versions.get("package_version", "unknown"))
description += " fixed version: {fixed}\n".format(fixed=versions.get("fixed_version", "unknown"))
description += "<p> installed version: {installed}</p>".format(installed=versions.get("package_version", "unknown"))
description += "<p> fixed version: {fixed}</p>".format(fixed=versions.get("fixed_version", "unknown"))

link = vulnerability.get("link") if "link" in vulnerability else ""

Expand All @@ -165,6 +166,13 @@ def get_asset_item(vulnerability, test):

vulnerability_id = vulnerability.get("name")

# there is nothing like short description, short name or title
package_names_combined = ','.join(sorted(set(package_names), key=str))
if len(package_names_combined) > 32:
package_names_combined = package_names_combined[-32:]

title = "{packages}: ({vuln})".format(packages=package_names_combined, vuln=vulnerability.get("name").upper())

# create the finding object
finding = Finding(
title=title,
Expand Down

0 comments on commit c3f009d

Please sign in to comment.