Unable to ignore OS packages by name #9719
-
QuestionHello, I have attempted a variety of formats, including a .trivyignore file containing 3 different package name formats and a CVE: ...however only the CVE listed is correctly skipped. It is not viable for me to know the CVEs to skip in advance, but I can determine package names, even creating the PURL format (in the first line) if needed. Debug output from trivy only mentions: I am running trivy as root against the local OS: where $SKIP_DIRS is only TargetFilesystem ScannerVulnerability Output FormatJSON ModeStandalone Operating SystemUbuntu 22.04 on AWS Version$ trivy --version
Version: 0.67.2
Vulnerability DB:
Version: 2
UpdatedAt: 2025-09-16 18:30:59.391902472 +0000 UTC
NextUpdate: 2025-09-17 18:30:59.391902232 +0000 UTC
DownloadedAt: 2025-10-28 02:24:15.347489884 +0000 UTC
Java DB:
Version: 1
UpdatedAt: 2025-10-27 00:57:29.402495495 +0000 UTC
NextUpdate: 2025-10-30 00:57:29.402495325 +0000 UTC
DownloadedAt: 2025-10-27 06:14:57.959812322 +0000 UTC
# Note that the databases are downloaded using a pull-through cache, but this shouldn't affect the ignore configuration |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 22 replies
-
|
Hello @rungitringit ignore file and VEX files require CVE number to filter vulnerability. Regards, Dmitriy |
Beta Was this translation helpful? Give feedback.
-
|
Thank you @DmitriyLewen I think this will work! I've spent hours trying to solve this problem, yet it would be common to anyone scanning an OS or VM. Trivy really should include logic or an option to ignore old kernels which are not in use, such as is discussed here: #3764 (comment) Anyway for reference, here's a copy of my trivy-ignore.rego created from script as of today: |
Beta Was this translation helpful? Give feedback.
-
|
Unfortunately this doesn't seem to work(*). I still have vulnerabilities associated with packages matching those package names (using trivy packaging naming standard). Could you please give me a hint about where this might be going wrong? I'm producing JSON output from Trivy then using another project to convert it to HTML (to produce a richer HTML than is available with the Trivy HTML template). * It might be partly working?! I'm still getting vulns for the linux-headers-6.2.0-1013-aws package and now I'm wondering if I've mucked up renaming the packages in to the format trivy uses... |
Beta Was this translation helpful? Give feedback.
-
|
If I use both package name formats then it seems to work, but that's really ugly. |
Beta Was this translation helpful? Give feedback.
Hello @rungitringit
Thanks for your interest to Trivy.
ignore file and VEX files require CVE number to filter vulnerability.
But if i remember correctly you can write
regopolicy to filter vulns by package name - https://trivy.dev/latest/docs/configuration/filtering/#by-regoRegards, Dmitriy