Skip to content

Replace OSS Index with Sonatype Guide in VulnTotal - #2503

Open
k-charansai wants to merge 1 commit into
aboutcode-org:mainfrom
k-charansai:fix/replace-ossindex-with-sonatype-guide-2311
Open

k-charansai wants to merge 1 commit into
aboutcode-org:mainfrom
k-charansai:fix/replace-ossindex-with-sonatype-guide-2311

Conversation

@k-charansai

Copy link
Copy Markdown

OSS Index has transitioned to Sonatype Guide, with its compatible API endpoints now hosted at https://api.guide.sonatype.com. This update migrates VulnTotal’s OSS Index data source to the new Sonatype Guide API while introducing Personal Access Token (PAT) authentication through the SONATYPE_GUIDE_TOKEN environment variable.

The update also ensures full backward compatibility with existing OSS_USERNAME and OSS_TOKEN configurations.

Key changes include:

Updated API endpoints to use api.guide.sonatype.com.

Introduced SonatypeGuideDataSource, with OSSDataSource retained as an alias for backward compatibility.

Registered sonatype_guide in DATASOURCE_REGISTRY and CLI range mappings.

Added unit tests covering unauthenticated access, PAT-based authentication, and legacy authentication.

Closes #2311

OSS Index has transitioned to Sonatype Guide with compatibility API endpoints
hosted under https://api.guide.sonatype.com. Update VulnTotal's OSS Index datasource
to use the new Sonatype Guide endpoints and support Personal Access Token (PAT)
authentication via SONATYPE_GUIDE_TOKEN while maintaining full backward
compatibility with legacy OSS_USERNAME and OSS_TOKEN settings.

- Update API endpoints to api.guide.sonatype.com
- Introduce SonatypeGuideDataSource (aliased to OSSDataSource)
- Register sonatype_guide in DATASOURCE_REGISTRY and CLI range mappings
- Add unit tests for unauthenticated, PAT-only, and legacy authentication

Closes aboutcode-org#2311

Signed-off-by: k-charansai <[email protected]>

@sanchit955 sanchit955 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.

Verified locally on this head (033a01f): vulntotal/tests/test_oss_index.py — 7 passed, and the full vulntotal/tests/ suite — 32 passed. I also confirmed via the registry that sonatype_guide resolves to SonatypeGuideDataSource and oss_index still resolves to the same class through the alias, so existing configs keep working.

The new tests pin the auth behaviour well: unauthenticated requests go to the public component-report endpoint with no auth, a PAT alone uses the authorized endpoint with ("token", token), and the legacy OSS_USERNAME/OSS_TOKEN pair still authenticates against the new host. One small suggestion: with only SONATYPE_GUIDE_TOKEN set, the username silently falls back to "token" — worth a line in the docs or env example so users know they do not need to invent a username to go with a PAT. The code itself reads correctly.

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.

Replace OSSindex with new Sonatype Guide

2 participants