Skip to content

Add Trivy container vulnerability scanning#1

Merged
dpark01 merged 2 commits intomainfrom
add-trivy-container-scanning
Mar 31, 2026
Merged

Add Trivy container vulnerability scanning#1
dpark01 merged 2 commits intomainfrom
add-trivy-container-scanning

Conversation

@dpark01
Copy link
Copy Markdown
Member

@dpark01 dpark01 commented Mar 31, 2026

Summary

  • Adds Trivy vulnerability scanning to the Docker build workflow as a separate scan job
  • Scans run on every push (using the exact image tag from the build) and weekly on the latest image via schedule cron
  • Manual scans supported via workflow_dispatch
  • Build job is gated to skip on schedule/dispatch events — only scans existing images, keeping tags immutable
  • Includes a CVSS-based Rego ignore policy (.trivy-ignore-policy.rego) for batch bioinformatics containers, shared with viral-ngs and py3-bio
  • Empty .trivyignore template for per-CVE exceptions (to be triaged after first scan)
  • SARIF results upload to GitHub Security tab; table output in workflow logs with exit-code: 1 (blocking)

Test plan

  • Verify the scan job runs after build on this branch push
  • Check GitHub Actions logs for Trivy table output and finding count
  • Check the GitHub Security tab for uploaded SARIF results
  • After merge, manually trigger via workflow_dispatch and verify scan-only behavior (no rebuild)
  • Review initial findings and add per-CVE exceptions to .trivyignore if needed

🤖 Generated with Claude Code

Add build-time and scheduled Trivy scanning to the Docker workflow.
Scans run after each push (using the built image tag) and weekly on
the latest image. Includes a CVSS-based Rego ignore policy for batch
bioinformatics containers and an empty .trivyignore for per-CVE
exceptions. Results upload to GitHub Security tab via SARIF.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-advanced-security
Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

By default, trivy-action ignores the severity filter for SARIF output,
causing medium/low findings to leak into the GitHub Security tab. The
limit-severities-for-sarif flag enforces the CRITICAL,HIGH filter on
SARIF output as well.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dpark01 dpark01 merged commit eb85114 into main Mar 31, 2026
5 checks passed
@dpark01 dpark01 deleted the add-trivy-container-scanning branch March 31, 2026 14:50
dpark01 added a commit to broadinstitute/viral-ngs that referenced this pull request Mar 31, 2026
By default, trivy-action ignores the severity filter when producing
SARIF output, allowing medium/low findings to leak into the GitHub
Security tab. Adding limit-severities-for-sarif: true ensures only
CRITICAL and HIGH findings appear in SARIF uploads.

Inspired by broadinstitute/read-qc-tools#1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

2 participants