Skip to content
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

Handle pysec data with ghsa #101

Merged
merged 1 commit into from
Feb 25, 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
3 changes: 1 addition & 2 deletions test/test_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,7 @@ def test_osv_convert(
assert cve_data
assert len(cve_data) == 1
cve_data = osvlatest.convert(test_osv_pypi2_json)
assert cve_data
assert len(cve_data) == 1
assert not cve_data


def test_aqua_convert(
Expand Down
8 changes: 8 additions & 0 deletions vdb/lib/osv.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@ def to_vuln(cve_data):
references = orjson.dumps(references, option=orjson.OPT_NAIVE_UTC)
if isinstance(references, bytes):
references = references.decode("utf-8", "ignore")
# Quality of PYSEC data is quite low missing both severity and score
# Where a PYSEC feed also reference a github id, let's ignore it since G comes before P
# so it would have gotten processed
# Fixes #99
if cve_id.startswith("PYSEC"):
for i in aliases:
if i.startswith("GHSA"):
return ret_data
# Try to locate the CVE id from the aliases section
if not cve_id.startswith("CVE") and not cve_id.startswith("RUSTSEC"):
for i in aliases:
Expand Down
Loading