Skip to content

Support Sonatype Guide tokens for OSS Index analyzer#5994

Merged
nscuro merged 1 commit intoDependencyTrack:masterfrom
nscuro:ossi-guide-token
Apr 2, 2026
Merged

Support Sonatype Guide tokens for OSS Index analyzer#5994
nscuro merged 1 commit intoDependencyTrack:masterfrom
nscuro:ossi-guide-token

Conversation

@nscuro
Copy link
Copy Markdown
Member

@nscuro nscuro commented Apr 2, 2026

Description

Supports Sonatype Guide tokens for OSS Index analyzer.

Sonatype Guide uses bearer tokens, whereas OSS Index expects basic auth using email and token.

Note that the OSS Index API does not yet support Guide tokens, but will soon. This change ensures a smooth transition when the time comes.

Addressed Issue

Relates to #5977

Additional Details

N/A

Checklist

  • I have read and understand the contributing guidelines
  • This PR fixes a defect, and I have provided tests to verify that the fix is effective
  • This PR implements an enhancement, and I have provided tests to verify that it works as intended
  • This PR introduces changes to the database model, and I have added corresponding update logic
  • This PR introduces new or alters existing behavior, and I have updated the documentation accordingly

Sonatype Guide uses bearer tokens, whereas OSS Index expects basic auth using email and token.

Note that the OSS Index API does not yet support Guide tokens, but will soon. This change ensures a smooth transition when the time comes.

Signed-off-by: nscuro <[email protected]>
@nscuro nscuro added enhancement New feature or request integration/ossindex Related to the Sonatype OSS Index integration backport/4.14.1 PRs to be backported to v4.14.1 labels Apr 2, 2026
Copilot AI review requested due to automatic review settings April 2, 2026 17:36
@owasp-dt-bot
Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@codacy-production
Copy link
Copy Markdown

codacy-production bot commented Apr 2, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 5 complexity · 4 duplication

Metric Results
Complexity 5
Duplication 4

View in Codacy

🟢 Coverage 100.00% diff coverage · +0.00% coverage variation

Metric Results
Coverage variation +0.00% coverage variation (-1.00%)
Diff coverage 100.00% diff coverage (70.00%)

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (d3ff4c1) 24774 20111 81.18%
Head commit (28d5f7c) 24779 (+5) 20116 (+5) 81.18% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#5994) 15 15 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

TIP This summary will be updated as you push new changes. Give us feedback

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the OSS Index analyzer to accept Sonatype Guide-style bearer tokens (in addition to the existing OSS Index basic-auth credentials), with accompanying test coverage.

Changes:

  • Allow OSS Index analysis to proceed with only an API token (no username) when the token is identified as a Guide bearer token.
  • Send Authorization: Bearer … for Guide tokens; otherwise continue using basic auth with username + token.
  • Extend/adjust unit tests to cover bearer-token behavior and the “missing username” scenario.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/main/java/org/dependencytrack/tasks/scanners/OssIndexAnalysisTask.java Adds bearer-token detection and conditionally sets the Authorization header as Bearer vs Basic.
src/test/java/org/dependencytrack/tasks/scanners/OssIndexAnalysisTaskTest.java Updates the “missing user” test and adds new tests asserting bearer auth header behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nscuro nscuro merged commit 604b3ba into DependencyTrack:master Apr 2, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/4.14.1 PRs to be backported to v4.14.1 enhancement New feature or request integration/ossindex Related to the Sonatype OSS Index integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants