Skip to content

UID2-7861: apply .trivyignore.rego ignore policy when present - #266

Merged
mcollins-ttd merged 1 commit into
mainfrom
mkc-UID2-7861-trivy-ignore-policy
Nov 2, 2026
Merged

mcollins-ttd merged 1 commit into
mainfrom
mkc-UID2-7861-trivy-ignore-policy

Conversation

@mcollins-ttd

Copy link
Copy Markdown
Contributor

Lets a repo ignore all findings for a named package (e.g. an unreachable Alpine OS library) with a .trivyignore.rego Rego policy, instead of adding each new CVE to .trivyignore.

  • The scan step sets TRIVY_IGNORE_POLICY when .trivyignore.rego exists at the repo root, like Trivy's own .trivyignore lookup. Repos without the file are unchanged.
  • Only the scan step needs it: later steps run trivy convert on its JSON, so the findings drop out of the SARIF, fail-only report and fail check too.
  • Tested with a copy of this action against the uid2-core base image: with a libexpat policy, all libexpat findings are gone and other findings are unchanged; without the file, results are unchanged.

Example policy:

package trivy

import rego.v1

default ignore := false

ignore if {
	input.PkgName == "libexpat"
	startswith(input.PkgIdentifier.PURL, "pkg:apk/")
}

🤖 Generated with Claude Code

Lets a repo ignore all findings for a named package, not one CVE at a time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mcollins-ttd
mcollins-ttd merged commit 8ae348d into main Nov 2, 2026
5 checks passed
@mcollins-ttd
mcollins-ttd deleted the mkc-UID2-7861-trivy-ignore-policy branch November 2, 2026 03:20
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