Skip to content

ci: move daily scan OSS Index analyzer to the Sonatype Guide API - #1507

Open
srprash wants to merge 1 commit into
mainfrom
fix/daily-scan-oss-index-guide
Open

srprash wants to merge 1 commit into
mainfrom
fix/daily-scan-oss-index-guide

Conversation

@srprash

@srprash srprash commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Issue #, if available:

Description of changes:

Context (preventive)

The daily scan in this repo is currently green, but only because the OSS Index analyzer has had nothing to look up in recent runs, so the legacy credentials are not proven to work. The sibling ADOT repos running the same step (Python, JS, .NET) fail on every run with exit code 14 for the reasons below (example run in the Python repo). This applies the same change here for consistency, before it starts failing.

Why

  • Exit 14 is DependencyCheck's "exceptions during analysis" code; a CVSS finding would exit 15. All of the exceptions come from the Sonatype OSS Index analyzer (Failed to request component-reports).
  • Those exceptions are thrown before --failOnCVSS is evaluated, so the scan aborts without ever reporting on CVEs. The step is red because of tooling, not because of a finding.
  • OSS Index has moved behind the Sonatype Guide API, and the legacy username/token pair no longer works there.
  • The workflow picks its DependencyCheck version from jeremylong.github.io/DependencyCheck/current.txt, which is no longer maintained and still returns 12.1.0.

What changed

In .github/workflows/daily-scan.yml:

  • Pin VERSION=13.0.0 instead of reading current.txt. 13.0.0 defaults the OSS Index URL to the Guide API and is signed with the same GPG key the step already imports.
  • Pass the Guide token from the existing OSS Index secret's Guide token field as --ossIndexPassword, and drop --ossIndexUsername.
  • Add --ossIndexRemoteErrorWarnOnly true.
  • Read the NVD key and the token from the step environment (quoted) instead of ${{ env.X }} interpolation into the script.
  • Print dependency scan results on failure: a step-level if without a status function carries an implicit success(), so the step was skipped on exactly the failures it exists to report. It is now always() && steps.dep_scan.outcome != 'success', and uses cat instead of less (no pager in CI).
  • The step here goes through execute_and_retry; the command string keeps that layout, with the explanation moved to a comment above the step since the single-quoted command cannot hold comments. Env vars are expanded when the action evals the command.

All other flags (suppression file, scan target, --failOnCVSS, etc.) are unchanged. The secret fetch step already flattens that secret into env vars, so no change is needed there.

Why no --ossIndexUsername

It is deprecated for Guide tokens and is not just redundant: DependencyCheck builds basic auth as base64(username:password), so a non-empty username sends user:token instead of the :token form the Guide token scheme expects. Upstream docs describe the username as optional when using a Guide token.

Why warn-only

Without it, any remote OSS Index failure (rate limiting, server errors, timeouts) throws an AnalysisException and produces the same abort-before-the-CVSS-gate exit 14. With it, such failures are logged as warnings and only the OSS Index enrichment degrades; NVD findings still fail the build. A missing or malformed token does not silently pass either: the analyzer logs that it is disabled due to missing credentials.

This mirrors aws/aws-xray-daemon#300, which is merged and whose dependency scan step is green with the same change (recent run).

The org.owasp.dependencycheck Gradle plugin applied in otelagent is not invoked by this workflow and is not touched.

Testing

  • Workflow parses as YAML and passes actionlint locally (no new findings).
  • The workflow assumes an AWS role that only trusts the default branch, so a dispatch from this branch cannot run the scan end to end. The identical change is live in aws-xray-daemon, and the token field it relies on is already populated in this repo's scan runs.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Pin DependencyCheck to 13.0.0 instead of reading the unmaintained
current.txt feed (stuck at 12.1.0), authenticate OSS Index with the
Guide token as the password only, set --ossIndexRemoteErrorWarnOnly,
read secrets from the environment, and make the failure print step
actually run on failure.
@srprash
srprash requested a review from a team as a code owner December 4, 2026 20:02
@srprash srprash added the skip changelog doesn't need a CHANGELOG entry label Dec 4, 2026

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

skip changelog doesn't need a CHANGELOG entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant