← Back to Pull requests

ci: scan the source code daily for vulnerable dependencies and malware #2336

Closed
unknown closed this pull request without merging on Nov 10, 2026 11:56 UTC
View on GitHub
unknown unknown commented on Nov 06, 2026 12:04 UTC
Author

Summary

Closes #2331. Part of #2325.

Problem

The only security scan in our GitHub workflows is CodeQL, and it checks the code we write. Nothing checks the code we depend on: the Go modules listed in each go.mod file and the Python packages listed in each poetry.lock file. When one of those dependencies has a published vulnerability, nothing on GitHub tells us. Nothing checks the repository for malware either.

What this PR adds

A new workflow, Daily Security Scan, runs every day at 07:30 UTC on the main branch. A maintainer can also start it from the Actions tab. It runs two scans on GitHub-hosted runners:

  • Grype is an open source vulnerability scanner. It reads every go.mod and poetry.lock file in the repository and compares the versions in them with public vulnerability databases. The workflow reports a vulnerability only when a newer version of the dependency fixes it, so every report can be acted on.

  • ClamAV is an open source antivirus scanner. It checks every file in the repository for known malware. If it finds any, the job fails.
  • Where the results go

    Both scans write their results in SARIF, a standard format for the output of analysis tools. The workflow uploads the SARIF files to GitHub code scanning, which is where CodeQL results already go. Each finding then appears as an alert in the repository's Security tab, under Code scanning. You can filter the alerts by tool (Grype or ClamAV).

    An alert stays open until a later scan no longer reports it, for example after a dependency update. GitHub then closes it automatically. A maintainer can also dismiss an alert with a reason.

    Grype gives each vulnerability a severity. This workflow shows medium, high and critical vulnerabilities as errors, and low and negligible ones as warnings. Both kinds are reported.

    Files

  • .github/workflows/security-scan.yml: the daily workflow, with one job for each scan.

  • .github/actions/security-scan/action.yml: runs Grype and uploads its results. #2332 will use it again to scan our container images.

  • .github/actions/malware-scan/action.yml: runs ClamAV, converts its output to SARIF and uploads it.
  • The two actions are based on the actions that do the same job in NVIDIA/aicr, another NVIDIA open source project. They differ in five ways:

  • If a scanner itself fails, for example because it cannot download its vulnerability database, the job fails. In aicr, the job passes in this case without any result, so a broken scan looks like a clean one.

  • The steps that download packages and virus definitions run through scripts/retry.sh, which our other workflows use to try again after a network error.

  • Values reach the shell scripts through environment variables, not through ${{ }} expressions inside the script.

  • ClamAV writes its log and results to the runner's temporary directory, outside the repository, so it does not scan its own output.

  • Each ClamAV alert has a fingerprint made of the file path and the malware signature. GitHub uses the fingerprint to recognize an alert it has already seen. It cannot compute one for these results, because they have no line number. Without it, a file that is found again on a later day could open a second alert.
  • What the first run will show

    A test run in my fork (see Testing) reported 81 Grype alerts for 10 vulnerabilities. Most alerts are the same vulnerability in many modules, because each module has its own go.mod file:

  • golang.org/x/net v0.61.0 has two vulnerabilities, one high and one medium, and appears in 32 go.mod files. Version 0.62.0 fixes both.

  • golang.org/x/crypto v0.58.0 has one vulnerability and appears in 10 go.mod files.

  • github.com/go-jose/go-jose/v4 has three vulnerabilities, one high and two medium.

  • setuptools (two) and pygments (one) in two poetry.lock files.

  • tj-actions/changed-files v42.1.0 in .github/workflows/lint-test.yml has advisory GHSA-mrrh-fwg8-r2c3, an attack in March 2025 that changed the action's version tags. Our workflow pins a commit from March 2024, so the attack does not affect us.
  • The numbers change from day to day as the vulnerability databases are updated.

    Some of these alerts come from go.mod files under demos/, tilt/ and tests/, which are not part of the product. #2330 adds a configuration file to exclude such paths, and a file to record vulnerabilities that do not affect NVSentinel, such as the tj-actions advisory.

    Type of Change


  • 🐛 Bug fix

  • ✨ New feature

  • 💥 Breaking change

  • 📚 Documentation

  • 🔧 Refactoring

  • 🔨 Build/CI
  • Component(s) Affected


  • Health Monitor

  • Core Service

  • Fault Management

  • Janitor

  • Deployment/Config

  • API/Interface

  • Preflight

  • Plugins

  • Documentation/CI

  • New Component

  • Multiple Components

  • Other
  • Testing


  • Tests pass locally

  • Manual testing completed

  • No breaking changes (or documented)
  • Tested in my fork on a throwaway branch, because the workflow runs only from the default branch:

  • Clean scan: both jobs passed. Grype uploaded 81 alerts. ClamAV scanned 2,120 files and found nothing.

  • EICAR test file added: ClamAV opened an alert and the job failed.

  • Same file found again: the same alert was updated, not duplicated.

  • File removed: the alert closed.
  • Checklist


  • Self-review completed

  • Documentation updated (if needed)

  • Ready for review
  • <!-- This is an auto-generated comment: release notes by coderabbit.ai -->
    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    New Features
    Added daily and manually triggered scans for repository vulnerabilities and malware.
    Vulnerability findings for fixed issues at medium severity or higher are reported in GitHub’s Security tab. Scanner errors can fail the scan.
    Malware scan results are reported in the Security tab, including files skipped because they exceed scan size limits. Detected infections or scan errors cause the scan to fail.
    * Both scans let you select a path to scan, defaulting to the repository root.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: KaivalyaMDabhadkar Review duration: 5751m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #2336"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%