From 32b582d71e49493e7fee622c6dd5db8de70f5008 Mon Sep 17 00:00:00 2001 From: Pavel Nakonechnyi Date: Wed, 31 Jul 2024 15:51:51 +0200 Subject: [PATCH] t --- dojo/tools/trivy_operator/checks_handler.py | 4 ++-- dojo/tools/trivy_operator/vulnerability_handler.py | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/dojo/tools/trivy_operator/checks_handler.py b/dojo/tools/trivy_operator/checks_handler.py index 6364d7b60f..7c72cabb99 100644 --- a/dojo/tools/trivy_operator/checks_handler.py +++ b/dojo/tools/trivy_operator/checks_handler.py @@ -37,11 +37,11 @@ def handle_checks(self, endpoint, service, checks, test): for message in check.get("messages"): details += f"{message}\n" - scope = "" + scope = "undefined" if check.get("scope"): scope_type = check.get("scope").get("type") scope_value = check.get("scope").get("value") - scope=f"{scope_type} {scope_value}" + scope = f"{scope_type} {scope_value}" description = CHECK_DESCRIPTION_TEMPLATE.format( category=check.get("category"), diff --git a/dojo/tools/trivy_operator/vulnerability_handler.py b/dojo/tools/trivy_operator/vulnerability_handler.py index 8927173a1d..7b41c956c9 100644 --- a/dojo/tools/trivy_operator/vulnerability_handler.py +++ b/dojo/tools/trivy_operator/vulnerability_handler.py @@ -1,6 +1,7 @@ from dojo.models import Finding DESCRIPTION_TEMPLATE = """{title} +**Details:** {description} **Fixed version:** {fixed_version} CVE published on: {published_date} @@ -56,11 +57,15 @@ def handle_vulns(self, endpoint, service, vulnerabilities, test): else: file_path = None + vuln_description = "no details" + if len(vulnerability.get("description", "")) > 0: + vuln_description = vulnerability.get("description") + description = DESCRIPTION_TEMPLATE.format( title=vulnerability.get("title"), fixed_version=mitigation, published_date=vulnerability.get("publishedDate"), - description=vulnerability.get("description") + description=vuln_description ) title = f"{vuln_id} {package_name} {package_version}"