Skip to content
Open
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
6 changes: 5 additions & 1 deletion csaf/analyser.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,11 @@ def analyse(self):
if "notes" in self.data["document"]:
for note in self.data["document"]["notes"]:
# Notes can be multi-line. Split text up across multiple lines
self._multiline(note["title"], note["text"])
# category and text are mandatory.
if "title" not in note:
self._multiline(note["category"],note["text"])
else:
self._multiline(note["title"], note["text"])
if "publisher" in self.data["document"]:
publisher_info = (
f"{self.data['document']['publisher']['name']} "
Expand Down
14 changes: 10 additions & 4 deletions csaf/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ def _process_metadata(self):
if "notes" in document:
notes = []
for note in document["notes"]:
note_ref = {'title': note["title"], 'text' : note['text'], 'category': note['category']}
note_ref = {'text' : note['text'], 'category': note['category']}
if "title" in note:
note_ref['title']=note["title"]
notes.append(note_ref)
self.metadata["notes"] = notes
if "publisher" in document:
Expand Down Expand Up @@ -154,7 +156,8 @@ def _process_vulnerabilities(self):
vuln_info = Vulnerability(validation="csaf")
for vulnerability in self.data["vulnerabilities"]:
vuln_info.initialise()
vuln_info.set_id(vulnerability["cve"])
if "cve" in vulnerability:
vuln_info.set_id(vulnerability["cve"])
if "title" in vulnerability:
vuln_info.set_value("title", vulnerability["title"])
if "cwe" in vulnerability:
Expand All @@ -165,12 +168,15 @@ def _process_vulnerabilities(self):
if "discovery_date" in vulnerability:
vuln_info.set_value("discovery_date", vulnerability["discovery_date"])
if "flags" in vulnerability:
products = []
for flag in vulnerability["flags"]:
if "label" in flag:
vuln_info.set_value("justification", flag["label"])
vuln_info.set_value("created", flag["date"])
if "date" in flag:
vuln_info.set_value("created", flag["date"])
for product in flag["product_ids"]:
vuln_info.set_value("Product", product)
products.append(product)
vuln_info.set_value("product", products)
if "ids" in vulnerability:
for id in vulnerability["ids"]:
vuln_info.set_value("system_name", vulnerability["text"])
Expand Down