Skip to content

Replace Snyk scans with Trivy - #557

Open
pvannierop wants to merge 4 commits into
devfrom
ci/snyk-to-trivy
Open

pvannierop wants to merge 4 commits into
devfrom
ci/snyk-to-trivy

Conversation

@pvannierop

Copy link
Copy Markdown
Contributor

Replaces the Snyk GitHub Actions scans with Trivy, as part of the move away from Snyk across RADAR-base.

Old (Snyk) New (Trivy)
snyk.yaml: PR gate, --severity-threshold=high --fail-on=upgradable trivy.yaml: PR gate on fixable HIGH/CRITICAL findings (--severity HIGH,CRITICAL --ignore-unfixed), plus a job summary that lists every finding at every severity
scheduled-snyk.yaml: weekly scan, SARIF upload scheduled-trivy.yaml: weekly scan of all severities, SARIF to Code scanning (category trivy-dependencies)
scheduled-snyk-docker.yaml scheduled-trivy-docker.yaml: weekly base image scan (--pkg-types os)
.snyk .trivyignore.yaml (no entries; the file must exist for Trivy 0.74)

Gradle dependencies are visible to Trivy only through lockfiles, so the workflows first lock runtimeClasspath with .github/trivy-lock.init.gradle, the same classpath the Snyk gate scanned (--configuration-matching="^runtimeClasspath$"). Build tooling and test dependencies don't fail the gate. Actions are pinned by commit SHA and Trivy to v0.74.0.

Snyk ignores are not carried over: they were added to quiet Snyk until this move, so Trivy reports those findings.

Local dry run on dev (Trivy 0.74.0): all: {'HIGH': 65, 'MEDIUM': 84, 'CRITICAL': 11, 'LOW': 8}, gate (fixable HIGH/CRITICAL): {'HIGH': 65, 'CRITICAL': 11}.
Merge this after the security PR #556: until then dev still has the old dependency versions, so this PR's own Trivy check is expected to fail.

Follow-ups for maintainers: if branch protection or a ruleset requires the Snyk security check, the Trivy job keeps that name. The scheduled workflows only run from the default branch, so they start once this is released. Old Snyk alerts in Code scanning can be closed in bulk (tool:Snyk), and Snyk's own GitHub integration and the SNYK_TOKEN secret can be removed once no repo uses them.

🤖 Generated with Claude Code

pvannierop and others added 4 commits October 1, 2026 10:10
- trivy.yaml: PR gate on fixable HIGH/CRITICAL findings
  (was snyk.yaml with --severity-threshold=high --fail-on=upgradable),
  plus a job summary with all findings
- scheduled-trivy.yaml: weekly code base scan, SARIF to Code scanning
- scheduled-trivy-docker.yaml: weekly base image scan (OS packages, like Snyk's --exclude-app-vulns), SARIF to Code scanning
- .github/trivy-lock.init.gradle: locks runtimeClasspath, so Trivy can read the Gradle dependencies
- .trivyignore.yaml: empty ignore list (Trivy 0.74 needs the file to exist)
- Remove .snyk. Its ignores were only meant to quiet Snyk until this move,
  so they are not carried over and Trivy reports those findings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Locking only needs the dependency graph, not the files. Resolving files
fails in multi-module Android builds (radar-commons-android), and the
lock script is kept the same in every RADAR-base repo. On this build the
lockfile is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ignore 7 HIGH findings until 2027-04-05, with the reason per entry:
certifi and urllib3 1.26.x in the appserver-legacy migration script (fixed only in urllib3 2.x / current certifi; not part of the image).

The remaining findings are fixed by the security PR into dev.
The branch filter was copied from the Snyk workflow, which listed main, but this repo's default branch is master. Release PRs into master weren't scanned.
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.

1 participant