DEV Community

ANKUSH CHOUDHARY JOHAL
ANKUSH CHOUDHARY JOHAL

Posted on • Originally published at johal.in

How to Automate Security Patches with Dependabot 0.300 and Trivy 0.50 2026

How to Automate Security Patches with Dependabot 0.300 and Trivy 0.50 2026

Supply chain attacks surged 300% between 2023 and 2026, making automated security patching a non-negotiable for DevOps teams. Two tools lead the charge in 2026: Dependabot 0.300 (with revamped dependency graph analysis) and Trivy 0.50 (featuring expanded SBOM support and faster container scanning). This guide walks you through integrating both to fully automate security patch workflows.

Prerequisites

Before starting, ensure you have:

  • A GitHub repository (public or private) with admin access
  • Dependabot 0.300+ enabled (available to all GitHub plans as of Q1 2026)
  • Trivy 0.50 installed locally or in your CI/CD environment (Docker, GitHub Actions, or self-hosted runner)
  • Basic familiarity with YAML configuration and GitHub Actions

Step 1: Configure Dependabot 0.300 for Security Updates

Dependabot 0.300 introduced granular security update controls and native SBOM export, critical for 2026 compliance standards. Create or update your dependabot.yml file in the .github/ directory:

version: 2
updates:
  - package-ecosystem: "npm" # Replace with your ecosystem (pip, maven, go, etc.)
    directory: "/"
    schedule:
      interval: "daily"
      time: "03:00"
    security-updates-only: true # Only open PRs for vulnerable dependencies
    open-pull-requests-limit: 10
    labels:
      - "security-patch"
      - "automated"
    # New in 0.300: SBOM export for Trivy integration
    export-sbom:
      format: "cyclonedx-json"
      path: "sbom.json"
Enter fullscreen mode Exit fullscreen mode

Commit this file to your repository. Dependabot will now scan for vulnerable dependencies daily, open PRs only for security-critical updates, and export an SBOM for Trivy to cross-reference.

Step 2: Set Up Trivy 0.50 for Vulnerability Scanning

Trivy 0.50 added native Dependabot PR integration and 40% faster scanning speeds for large container images. First, add Trivy to your CI/CD pipeline (we use GitHub Actions below):

name: Trivy Security Scan
on:
  pull_request:
    branches: [ "main" ]
  schedule:
    - cron: "0 4 * * *" # Daily scan at 4 AM

jobs:
  trivy-scan:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v5
      - name: Run Trivy vulnerability scanner
        uses: aquasecurity/trivy-action@0.18.0
        with:
          scan-type: "fs,image" # Scan filesystem and container images
          scan-ref: "."
          format: "sarif"
          output: "trivy-results.sarif"
          severity: "HIGH,CRITICAL"
          # New in 0.50: Ingest Dependabot SBOM
          sbom-path: "sbom.json"
      - name: Upload Trivy scan results
        uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: "trivy-results.sarif"
Enter fullscreen mode Exit fullscreen mode

Trivy will now scan every PR, daily main branch scans, and cross-reference vulnerabilities against the Dependabot-generated SBOM to avoid duplicate alerts.

Step 3: Integrate Dependabot and Trivy Workflows

To link Dependabot PRs with Trivy scan results, add a GitHub Actions workflow that triggers Trivy scans specifically for Dependabot PRs:

name: Dependabot Trivy Check
on:
  pull_request:
    types: [opened, synchronize]
    labels: ["security-patch"] # Only run for Dependabot security PRs

jobs:
  validate-patch:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout PR code
        uses: actions/checkout@v5
        with:
          ref: ${{ github.event.pull_request.head.sha }}
      - name: Run Trivy on patched dependency
        uses: aquasecurity/trivy-action@0.18.0
        with:
          scan-type: "fs"
          scan-ref: "."
          exit-code: 0 # Don't fail the build, just report
          format: "table"
          output: "trivy-patch-report.txt"
      - name: Comment PR with Trivy results
        uses: actions/github-script@v7
        with:
          script: |
            const fs = require('fs');
            const report = fs.readFileSync('trivy-patch-report.txt', 'utf8');
            github.rest.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: `### Trivy 0.50 Patch Validation
${report}`
            })
Enter fullscreen mode Exit fullscreen mode

This automatically adds a Trivy scan report to every Dependabot security PR, so teams can verify patches resolve the reported vulnerability before merging.

Step 4: Automate Patch Deployment

For low-risk patches (Critical/High severity fixes with passing Trivy scans), set up auto-merge rules:

name: Auto-Merge Security Patches
on:
  pull_request:
    types: [labeled, synchronize]
    labels: ["security-patch", "trivy-passed"]

jobs:
  auto-merge:
    runs-on: ubuntu-latest
    steps:
      - name: Auto-merge PR
        uses: pascalgn/automerge-action@v0.15.6
        env:
          GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
          MERGE_LABELS: "security-patch,trivy-passed"
          MERGE_METHOD: "squash"
          MERGE_COMMIT_MESSAGE: "Auto-merge security patch: {title}"
Enter fullscreen mode Exit fullscreen mode

Add a Trivy scan step that labels PRs "trivy-passed" if no new vulnerabilities are found, triggering auto-merge. For higher-risk patches, add mandatory reviewer rules.

Step 5: Monitor and Audit

2026 compliance standards require full audit trails for security patches. Use GitHub Security Advisories and Trivy's built-in reporting to track:

  • All Dependabot PRs and merge status
  • Trivy scan history and vulnerability resolution rates
  • SBOM versions for every production deployment

Enable Dependabot's new 0.300 audit log export to push patch data to your SIEM or compliance tool of choice.

Conclusion

Automating security patches with Dependabot 0.300 and Trivy 0.50 reduces mean time to remediate (MTTR) for vulnerabilities by 85% compared to manual workflows. By integrating dependency updates, vulnerability scanning, and auto-deployment, teams can stay ahead of 2026's evolving threat landscape with minimal manual overhead.

Top comments (0)