Description
Make the id field optional in .trivyignore.yaml so that users can ignore all findings matching a given purls or paths entry, without listing every individual ID.
Motivation
In discussion #10414, a user wants to ignore all vulnerabilities for the linux-libc-dev package (500+ CVEs).
Currently, .trivyignore.yaml requires id and performs strict equality matching (pkg/result/ignore.go:90):
if id != finding.ID {
continue
}
This means users must enumerate every CVE ID, which is impractical for packages with hundreds of known vulnerabilities. The existing purls: field only narrows the scope of an already-matched ID; it cannot be used on its own.
Proposal
Allow id to be omitted. When id is empty, the entry matches any finding that satisfies the remaining filters (purls and/or paths).
Example
vulnerabilities:
- purls:
- "pkg:deb/ubuntu/linux-libc-dev"
statement: Kernel headers, not exercised at runtime
expired_at: 2026-12-31
misconfigurations:
- paths:
- "test/fixtures/**"
statement: Test fixtures, safe to ignore
Matching logic
Update IgnoreFindings.Match so that an empty finding.ID skips the ID equality check:
if finding.ID != "" && id != finding.ID {
continue
}
Validation
To prevent accidental suppression of all findings, reject entries where id, purls, and paths are all empty. This validation should run during YAML parsing so that misconfigurations fail fast with a clear error.
Scope of each scanner
| Scanner |
paths |
purls |
Filters usable when id is empty |
| Vulnerability |
v |
v |
paths, purls |
| Misconfiguration |
v |
|
paths |
| Secret |
v |
|
paths |
| License |
v |
|
paths |
purls remains vulnerability-only per the existing spec.
Additional considerations
- The legacy plain-text
.trivyignore format is unaffected (id remains the only valid content).
show-suppressed output is unaffected: it displays the actual detected finding ID (e.g., vuln.VulnerabilityID), not IgnoreFinding.ID.
- Docs and JSON schema need updates:
Alternatives considered
Wildcard id (e.g., id: "*" or id: "CVE-*"): more flexible but adds a new matching mode to maintain. Making id optional is simpler and composes naturally with the existing purls/paths filters.
Backward compatibility
Non-breaking. Existing .trivyignore.yaml entries that specify id continue to work unchanged.
Description
Make the
idfield optional in.trivyignore.yamlso that users can ignore all findings matching a givenpurlsorpathsentry, without listing every individual ID.Motivation
In discussion #10414, a user wants to ignore all vulnerabilities for the
linux-libc-devpackage (500+ CVEs).Currently,
.trivyignore.yamlrequiresidand performs strict equality matching (pkg/result/ignore.go:90):This means users must enumerate every CVE ID, which is impractical for packages with hundreds of known vulnerabilities. The existing
purls:field only narrows the scope of an already-matched ID; it cannot be used on its own.Proposal
Allow
idto be omitted. Whenidis empty, the entry matches any finding that satisfies the remaining filters (purlsand/orpaths).Example
Matching logic
Update
IgnoreFindings.Matchso that an emptyfinding.IDskips the ID equality check:Validation
To prevent accidental suppression of all findings, reject entries where
id,purls, andpathsare all empty. This validation should run during YAML parsing so that misconfigurations fail fast with a clear error.Scope of each scanner
pathspurlsidis emptypaths,purlspathspathspathspurlsremains vulnerability-only per the existing spec.Additional considerations
.trivyignoreformat is unaffected (idremains the only valid content).show-suppressedoutput is unaffected: it displays the actual detected finding ID (e.g.,vuln.VulnerabilityID), notIgnoreFinding.ID.idrow fromRequired: vto a note that at least one ofid/purls/pathsis required.// required: truecomment on ignore.go:29.Alternatives considered
Wildcard
id(e.g.,id: "*"orid: "CVE-*"): more flexible but adds a new matching mode to maintain. Makingidoptional is simpler and composes naturally with the existingpurls/pathsfilters.Backward compatibility
Non-breaking. Existing
.trivyignore.yamlentries that specifyidcontinue to work unchanged.