Skip to content

fix: ingest Go advisories in GitHub importers - #2560

Open
Naman-Katiyar wants to merge 2 commits into
aboutcode-org:mainfrom
Naman-Katiyar:fix-1039-golang
Open

Naman-Katiyar wants to merge 2 commits into
aboutcode-org:mainfrom
Naman-Katiyar:fix-1039-golang

Conversation

@Naman-Katiyar

Copy link
Copy Markdown

Fixes #1039

Summary

Go advisories from GitHub sources were not being ingested because the Go ecosystem was disabled in both GitHub importers:

  • GitHubAPIImporterPipeline.package_type_by_github_ecosystem had the "GO": "golang" mapping commented out, so the GitHub GraphQL API was never queried for the GO ecosystem.
  • GithubOSVImporterPipeline had "golang" commented out of its supported ecosystems, so Go advisories from the GitHub Advisory Database were parsed but their affected packages were dropped as unsupported.

This PR enables the Go ecosystem in both importers. The downstream handling already supports golang: get_purl handles golang packages, univers provides GolangVersionRange for the advisory version ranges, and the OSV v2 parser already maps the Go ecosystem to golang PURLs (PURL_TYPE_BY_OSV_ECOSYSTEM). This is the Go slice of #1039; the other ecosystems discussed there are either already ingested or not supported yet.

Test report

I added two regression tests:

  • test_collect_advisories_includes_golang_ecosystem in vulnerabilities/tests/pipelines/test_github_importer_pipeline.py: mocks the GitHub GraphQL fetch, runs collect_advisories, and asserts that the GO ecosystem is queried and that the yielded advisories carry golang packages.
  • test_collect_advisories_from_github_osv_golang in vulnerabilities/tests/pipelines/v2_importers/test_github_osv_importer_v2.py: feeds a Go OSV advisory through collect_advisories and asserts that its affected package is kept with type golang.

Fail-before / pass-after evidence:

  • Without this change, both new tests fail: the GO ecosystem is never queried (assert 'GO' in ['MAVEN', 'NUGET', 'COMPOSER', 'PIP', 'RUBYGEMS', 'NPM', 'RUST']), and the Go OSV advisory yields affected_packages == [] with an "Unsupported package type" log.
  • With this change, both new tests pass.

Validation run locally with pytest:

  • vulnerabilities/tests/pipelines/test_github_importer_pipeline.py: 16 passed (including the existing parametrized process_response tests for all ecosystems, golang included).
  • vulnerabilities/tests/pipelines/v2_importers/test_github_osv_importer_v2.py and vulnerabilities/tests/test_github_osv.py: 10 passed.
  • vulnerabilities/tests/test_osv.py: 24 passed.

Changed files are formatted with black and isort.

Enable the GO ecosystem in the GitHub API importer and golang in the GitHub OSV v2 importer so Go advisories are collected instead of skipped. The downstream parsing already supports golang: get_purl handles golang packages, univers provides GolangVersionRange, and the OSV v2 parser maps the Go ecosystem to golang PURLs.

resolves: aboutcode-org#1039
Signed-off-by: Naman Katiyar <namankatiyar120@gmail.com>
Add regression tests asserting that the GitHub API importer queries the GO ecosystem and yields golang packages, and that the GitHub OSV v2 importer keeps affected packages for Go advisories. Both tests fail without the ecosystem enablement and pass with it.

Signed-off-by: Naman Katiyar <namankatiyar120@gmail.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 17:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ingest github ecosystems

2 participants