Refactor OvalDataSource to  work with VulnerabilityReferenceUnit dataclass
@@ -67,15 +67,14 @@ class Advisory:
summary: str
impacted_package_urls: Iterable[PackageURL]
resolved_package_urls: Iterable[PackageURL] = dataclasses.field(default_factory=list)
- vuln_references = Sequence[VulnerabilityReferenceUnit] = dataclasses.field(default_factory=list)
+ vuln_references : List[VulnerabilityReferenceUnit] = dataclasses.field(default_factory=list)
cve_id: Optional[str] = None
def __hash__(self):
- s = '{}{}{}{}{}'.format(
+ s = '{}{}{}{}'.format(
self.summary,
''.join(sorted([str(p) for p in self.impacted_package_urls])),
''.join(sorted([str(p) for p in self.resolved_package_urls])),
- ''.join(sorted(self.reference_urls)),
self.cve_id,
)
return hash(s)
@@ -481,7 +480,7 @@ class OvalDataSource(DataSource):
description = definition_data['description']
affected_purls = set()
safe_purls = set()
- urls = definition_data['reference_urls']
+ references = [VulnerabilityReferenceUnit(url=url) for url in definition_data['reference_urls']]
for test_data in definition_data['test_data']:
for package in test_data['package_list']:
@@ -520,5 +519,5 @@ class OvalDataSource(DataSource):
impacted_package_urls=affected_purls,
resolved_package_urls=safe_purls,
cve_id=vuln_id,
- reference_urls=urls))
+ vuln_references=references))
return all_adv
