diff --git a/dojo/tools/neuvector/parser.py b/dojo/tools/neuvector/parser.py index 274ac39fd9..35a6ea8704 100644 --- a/dojo/tools/neuvector/parser.py +++ b/dojo/tools/neuvector/parser.py @@ -130,6 +130,8 @@ def get_item(vulnerability, test): **Reference**: {reference} **Affected packages:** {affected_packages} +**Affected systems:** +{affected_systems} """ @@ -166,6 +168,43 @@ def get_asset_item(vulnerability, test): affected_packages += "\n" + nodes = vulnerability.get("nodes", []) + workloads = vulnerability.get("workloads", []) + images = vulnerability.get("images", []) + platforms = vulnerability.get("platforms", []) + + # the same information is saved as Endpoint(s), however, DefectDojo + # Endpoint lacks many metadata fields, thus, difficult to read. + affected_systems = "" + + for asset in nodes: + display_name = asset.get("display_name", "") + domains = asset.get("domains", []) + affected_systems += f"*Node {display_name}*\n" + affected_systems += f" domains: {domains}\n" + + for asset in platforms: + display_name = asset.get("display_name", "") + domains = asset.get("domains", []) + affected_systems += f"*Platform {display_name}*\n" + affected_systems += f" domains: {domains}\n" + + for asset in images: + display_name = asset.get("display_name", "") + domains = asset.get("domains", []) + affected_systems += f"*Image {display_name}*\n" + affected_systems += f" domains: {domains}\n" + + for asset in workloads: + display_name = asset.get("display_name", "") + domains = asset.get("domains", []) + service = asset.get("service", "") + image = asset.get("image", "") + affected_systems += f"*Workload {display_name}*\n" + affected_systems += f" domains: {domains}\n" + affected_systems += f" service: {service}\n" + affected_systems += f" image: {image}\n" + description = ASSET_FINDING_DESCRIPTION_TEMPLATE.format( title=vulnerability_id, description=vuln_description, @@ -173,6 +212,7 @@ def get_asset_item(vulnerability, test): published_date=published_date, reference=reference, affected_packages=affected_packages, + affected_systems=affected_systems, ) # create the finding object @@ -182,7 +222,7 @@ def get_asset_item(vulnerability, test): description=description, severity=severity, impact="", - references=[reference], + references=reference, cvssv3=vulnerability.get("vectors_v3", ""), cvssv3_score=vulnerability.get("score_v3", ""), publish_date=published_date, @@ -192,22 +232,18 @@ def get_asset_item(vulnerability, test): finding.unsaved_endpoints = [] - nodes = vulnerability.get("nodes", []) for asset in nodes: endpoints = endpoints_from_asset("node", asset) finding.unsaved_endpoints += endpoints - workloads = vulnerability.get("workloads", []) for asset in workloads: endpoints = endpoints_from_asset("workload", asset) finding.unsaved_endpoints += endpoints - images = vulnerability.get("images", []) for asset in images: endpoints = endpoints_from_asset("image", asset) finding.unsaved_endpoints += endpoints - platforms = vulnerability.get("platforms", []) for asset in platforms: endpoints = endpoints_from_asset("platform", asset) finding.unsaved_endpoints += endpoints