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

Ingest pub data through Github api #1417

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
5 changes: 3 additions & 2 deletions vulnerabilities/importers/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"PIP": "pypi",
"RUBYGEMS": "gem",
"NPM": "npm",
"PUB": "pub",
# "GO": "golang",
}

Expand All @@ -47,7 +48,7 @@
# TODO: We will try to gather more info from GH API
# Check https://github.com/nexB/vulnerablecode/issues/1039#issuecomment-1366458885
# Check https://github.com/nexB/vulnerablecode/issues/645
# set of all possible values of first '%s' = {'MAVEN','COMPOSER', 'NUGET', 'RUBYGEMS', 'PYPI', 'NPM'}
# set of all possible values of first '%s' = {'MAVEN','COMPOSER', 'NUGET', 'RUBYGEMS', 'PYPI', 'NPM', 'PUB'}
# second '%s' is interesting, it will have the value '' for the first request,
GRAPHQL_QUERY_TEMPLATE = """
query{
Expand Down Expand Up @@ -139,7 +140,7 @@ def get_purl(pkg_type: str, github_name: str) -> Optional[PackageURL]:
vendor, _, name = github_name.partition("/")
return PackageURL(type=pkg_type, namespace=vendor, name=name)

if pkg_type in ("nuget", "pypi", "gem", "golang", "npm"):
if pkg_type in ("nuget", "pypi", "gem", "golang", "npm", "pub"):
return PackageURL(type=pkg_type, name=github_name)

logger.error(f"get_purl: Unknown package type {pkg_type}")
Expand Down
Loading
Loading