Skip to content

Commit

Permalink
Do not crash when the name is None from purl (#82)
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
  • Loading branch information
prabhu authored Jan 3, 2024
1 parent d9d6e35 commit b53096f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
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.5.7"
version = "5.5.8"
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 = "cloud@appthreat.com"},
Expand Down
1 change: 1 addition & 0 deletions test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,3 +693,4 @@ def test_parse_purl():
"qualifiers": None,
"subpath": None,
}
assert utils.parse_purl("pkg:gem/remote:@https:%2F%2Frubygems.org%2F") == {}
4 changes: 4 additions & 0 deletions vdb/lib/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ def bulk_index_search(pkg_list):
# Fallback to using type as the vendor
vendor = pkg_type
name = purl_obj.get("name")
# Handle invalid purl that could lead to name becoming None
# See #81
if not name:
name = pkg.get("name")
version = purl_obj.get("version")
else:
vendor = pkg.get("vendor")
Expand Down

0 comments on commit b53096f

Please sign in to comment.