← All insightsSecurity

Securing Trivy: least privilege and safe defaults

CodeWizard Engineering · 26 March 2026 · 3 min read · Advanced

Security with Trivy is mostly correct, boring defaults applied consistently. Here is the short list that removes most of the risk.

Safe defaults

  • Add Trivy as a required check on pull requests
  • Generate SBOMs (CycloneDX/SPDX) for supply-chain visibility

Wire it into the pipeline

Fail the build on fixable high/critical CVEs.

yaml
- uses: aquasecurity/trivy-action@0.24.0
  with:
    image-ref: ghcr.io/${{ github.repository }}:${{ github.sha }}
    severity: HIGH,CRITICAL
    ignore-unfixed: true
    exit-code: 1

Reinforcing habits

  • Gate on HIGH/CRITICAL with ignore-unfixed, then tighten over time
  • Scan images, IaC and filesystems - not just one surface
  • Cache and periodically refresh the DB in CI

Want senior help putting Trivy to work - or a team bootcamp on it? CodeWizard runs Israel's largest DevOps community and embeds named senior engineers with a transparent hours log. Book a free consult or explore the Academy.

Like where this is going?

Get hands-on help from the engineers who write these posts.

Book a free consult