Changes to the handling of missing Trivy ignore file is a breaking change #9487
Replies: 3 comments 1 reply
-
hi @hctagalong - I'm curious how you're running into a failed scan since #7962 addressed this by adding exactly this. It should also be part of the latest release of the trivy action. |
Beta Was this translation helpful? Give feedback.
-
|
Here's the output from a quick test from my laptop where the referenced config file has this specified: Successful run / config references an empty ignorefileCommand Output Fatal error when trivy ignorefile is removedNote This matches my use case for the majority of our repos; the config file references an ignorefile however the ignorefile does not exist Command Output In this case, the scan is immediately failed because the ignore file is not found. Ideally, the scan continues / is unaffected and perhaps just outputs an INFO message about the ignorefile not being found. Trivy version info |
Beta Was this translation helpful? Give feedback.
-
|
Wondering if this was only a problem when running with a referenced config.yaml file I ran another test where I'm not passing in a config file: This yields the same behavior as I have reported above. If the .trivyignore.yml exists, the scan runs as expected. When the .trivyignore.yml file is missing, results in the same fatal error I reported. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
We needed to update the version of the Trivy action we use in our GitHub workflows from 0.28.0 to 0.33.1 to address a rego parsing error that suddenly appeared. That lead me to issue #7093 where handling of a missing trivy ignore file was reported as a bug. The prior behavior appears to have been changed per PR #7962.
The prior behavior of silently ignoring the missing file wasn't a bug for how we use the ignore feature. For our IaC scanning workflows, we use a common/centrally located Trivy config file pulled from a common repo via a reusable workflow. Within that common config file, it specifies
ignore file: ./.github/.trivyignore.yaml. Not every repo has findings to ignore; in those repos, there is no.trivyignore.yamlpresent and the prior behavior worked as expected -- silently ignored the not present .trivyignore,.yaml. For repos with findings that are approved to be ignored, those have a .trivyignore.yaml file in the location specified. For those repos, the ignorefile is present and works as expected.Desired Behavior
The scan ought not fail when an ignorefile is specified but not present. While I understand that we could add an empty ignore file to every repo that currently does not have one, this is not desirable for a few reasons:
Perhaps a compromise would be to produce an INFO level message when an ignorefile is specified but not found rather than fail the scan.
Actual Behavior
Scan fails when an ignorefile is specified in the configuration but not present.
Reproduction Steps
Run a trivy scan; specify an ignorefile within the Trivy config and ensure that the ignorefile is not present at the specified location. This will yield a fatal error.Target
Filesystem
Scanner
Vulnerability
Output Format
SARIF
Mode
Standalone
Debug Output
Operating System
Linux
Version
Checklist
trivy clean --allBeta Was this translation helpful? Give feedback.
All reactions