Repository navigation
UID2-8363: append shared Rego helpers to .trivyignore.rego when it uses them - #268
Merged
Merged
Conversation
…es them Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Ticket: UID2-8363 Branch: swi-UID2-8363-rego-helpers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Ticket: UID2-8363 Branch: swi-UID2-8363-rego-helpers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Ticket: UID2-8363 Branch: swi-UID2-8363-rego-helpers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Ticket: UID2-8363 Branch: swi-UID2-8363-rego-helpers
cYKatherine
approved these changes
Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Trivy reads exactly one
--ignore-policyfile and can't import other Rego files, so every repo's.trivyignore.regohas had to be self-contained. This adds shared helpers that a repo's policy can call.actions/vulnerability_scan/trivyignore-shared.rego(new): a fragment with nopackageorimportlines. Every name is prefixeduid_shared_. It starts withuid_shared_availability_only: true when the finding has CVSS data and no v3 or v4.0 vector, from any source, shows confidentiality or integrity impact.action.yaml: a new step picks the policy. If the repo's.trivyignore.regomentionsuid_shared_, the step writes.trivyignore.rego+ the helpers to$RUNNER_TEMPand passes that file to Trivy. Otherwise it passes.trivyignore.regounchanged, or nothing if there's no file. Repos that don't call a helper see no change.The helpers are read from
$GITHUB_ACTION_PATH, so they always match the version of the action being run.A repo's policy then only needs its own rule:
The repo's file must
import rego.v1(all existing.trivyignore.regofiles do). A policy that calls a helper without it being appended fails the scan with a Rego error, rather than passing.Tested locally by running the new step's script, then Trivy v0.70.0 (the trivy-action default), on three repo layouts: a policy that calls the helper (combined file; only findings with confidentiality or integrity impact remain), a policy that doesn't (passed through unchanged, same results as today), and no policy.
Ticket: UID2-8363
🤖 Generated with Claude Code