From 632239dc058dc6555ee0864a6cef94e41223fe3f Mon Sep 17 00:00:00 2001 From: Johannes Helmold Date: Thu, 25 Jan 2024 10:25:02 +0100 Subject: [PATCH] Fix: Handle missing excerpt in notes / overrides. --- pheme/transformation/scanreport/gvmd.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pheme/transformation/scanreport/gvmd.py b/pheme/transformation/scanreport/gvmd.py index 55f1090a..4f1f2c6f 100644 --- a/pheme/transformation/scanreport/gvmd.py +++ b/pheme/transformation/scanreport/gvmd.py @@ -248,9 +248,12 @@ def per_result(result): def per_note(note): result_notes = new_host_result.get("notes", []) + excerpt = "0" + if "excerpt" in note["text"] : + excerpt = note["text"]["excerpt"] new_note = { "text": note["text"]["text"], - "text_excerpt": note["text"]["excerpt"], + "text_excerpt": excerpt, } result_notes.append(new_note) @@ -265,9 +268,12 @@ def per_override(override): elif float(severity) > 0.0: severity_description = "Any positive severity" + excerpt = "0" + if "excerpt" in override["text"] : + excerpt = override["text"]["excerpt"] new_override = { "text": override["text"]["text"], - "text_excerpt": override["text"]["excerpt"], + "text_excerpt": excerpt, "severity": severity, "severity_description": severity_description, "new_severity": override["new_severity"],