Skip to content

Commit abd4fe7

Browse files
authored
fix: prepend justification to comments (#4442)
* workaround for #4439 I decided it was probably better to retain the 3.3 behaviour for now; we can decide if that's the right choice for future releases later. Signed-off-by: Terri Oda <[email protected]>
1 parent 5c3e103 commit abd4fe7

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

cve_bin_tool/vex_manager/parse.py

+5
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ def __process_vulnerabilities(self, vulnerabilities) -> None:
114114
justification = vuln.get("justification")
115115
response = vuln.get("remediation")
116116
comments = vuln.get("comment")
117+
118+
# If the comment doesn't already have the justification prepended, add it
119+
if comments and justification and not comments.startswith(justification):
120+
comments = f"{justification}: {comments}"
121+
117122
severity = vuln.get("severity") # Severity is not available in Lib4VEX
118123
# Decode the bom reference for cyclonedx and purl for csaf and openvex
119124
product_info = None

test/test_vex.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ class TestVexParse:
212212
},
213213
"CVE-1234-1005": {
214214
"remarks": Remarks.NotAffected,
215-
"comments": "NotAffected: Detail field populated.",
215+
"comments": "code_not_reachable: NotAffected: Detail field populated.",
216216
"response": "will_not_fix",
217217
"justification": "code_not_reachable",
218218
},

0 commit comments

Comments
 (0)