Read VARIoT alias records served in OSV shape
This commit is contained in:
1 parent
9c1638b5b8
commit
85451376f9
2 files changed
+16
-1
No files matched your search
@@ -721,5 +721,9 @@ def parse(source: str, raw: object, url: str) -> Doc:
|
||||
if source in {"siemens", "msrc", "industrial", "redhat", "fortinet"}:
|
||||
return _csaf(source, obj, url)
|
||||
if source == "circl":
|
||||
return _variot(obj, url)
|
||||
# VARIoT serves some aliases as OSV-shaped records keyed by the alias;
|
||||
# its own format carries affected_products and no OSV schema marker.
|
||||
if "affected_products" in obj or "schema_version" not in obj:
|
||||
return _variot(obj, url)
|
||||
return _osv(obj, url)
|
||||
raise ValueError("unsupported advisory source")
|
||||
@@ -410,3 +410,14 @@ def test_osv_empty_affected_block_is_skipped_not_fatal():
|
||||
{"package": {"name": "pkg", "ecosystem": "PyPI"}}],
|
||||
}, "https://osv.dev/GHSA-aaaa-bbbb-cccc")
|
||||
assert [p["name"] for p in doc.issues[0].products] == ["pkg"]
|
||||
|
||||
|
||||
def test_circl_osv_shaped_alias_record_is_accepted():
|
||||
from vuln_mcp.sources.parsers import parse
|
||||
|
||||
doc = parse("circl", {"schema_version": "1.5.0", "id": "BIT-apache-2021-42013",
|
||||
"modified": "2021-10-13T00:00:00Z",
|
||||
"affected": [{"package": {"name": "httpd", "ecosystem": "BIT"}}]},
|
||||
"https://vulnerability.circl.lu/api/vulnerability/BIT-apache-2021-42013")
|
||||
assert doc.native_id == "BIT-apache-2021-42013"
|
||||
assert doc.issues[0].products[0]["name"] == "httpd"
|
||||
Reference in new issue
Block a user