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 #100

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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "appthreat-vulnerability-db"
version = "5.6.3"
version = "5.6.4"
description = "AppThreat's vulnerability database and package search library with a built-in file based storage. OSV, CVE, GitHub, npm are the primary sources of vulnerabilities."
authors = [
{name = "Team AppThreat", email = "[email protected]"},
Expand Down
3 changes: 1 addition & 2 deletions test/test_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,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
2 changes: 1 addition & 1 deletion vdb/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def main():
# AquaSource also includes NVD
if args.cache_os:
sources.insert(0, AquaSource())
elif not args.only_aqua:
elif not args.only_aqua and not args.only_osv:
sources.append(NvdSource())
for s in sources:
LOG.info("Refreshing %s", s.__class__.__name__)
Expand Down
8 changes: 8 additions & 0 deletions vdb/lib/osv.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ def to_vuln(self, cve_data):
references = json_lib.dumps(references)
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