Skip to content

fix: prepend justification to comments #4442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cve_bin_tool/vex_manager/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ def __process_vulnerabilities(self, vulnerabilities) -> None:
justification = vuln.get("justification")
response = vuln.get("remediation")
comments = vuln.get("comment")

# If the comment doesn't already have the justification prepended, add it
if comments and justification and not comments.startswith(justification):
comments = f"{justification}: {comments}"

severity = vuln.get("severity") # Severity is not available in Lib4VEX
# Decode the bom reference for cyclonedx and purl for csaf and openvex
product_info = None
Expand Down
2 changes: 1 addition & 1 deletion test/test_vex.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class TestVexParse:
},
"CVE-1234-1005": {
"remarks": Remarks.NotAffected,
"comments": "NotAffected: Detail field populated.",
"comments": "code_not_reachable: NotAffected: Detail field populated.",
"response": "will_not_fix",
"justification": "code_not_reachable",
},
Expand Down
Loading