Non existing --ignorefile breaks pipelines #7856
Replies: 3 comments 4 replies
-
Are you able to fill out the reproduction steps section above? I'm not seeing this on my end trivy config --ignorefile ./invalid.file /tmp
2024-11-01T16:13:52-06:00 FATAL Fatal error flag error: report flag error: ignore file not found: ./invalid.file Which is correct behavior. |
Beta Was this translation helpful? Give feedback.
-
If I have an existing file which is empty (or any invalid yaml), the behavior is the following, which is what you have. $ touch invalid-file.yaml
$ ./trivy config --ignorefile ./invalid-file.yaml /tmp
2024-11-01T16:15:15-06:00 INFO [misconfig] Misconfiguration scanning is enabled
2024-11-01T16:15:15-06:00 INFO Detected config files num=0
2024-11-01T16:15:15-06:00 FATAL Fatal error filter error: filtering error: ./invalid-file.yaml error: ./invalid-file.yaml parse error: yaml decode error: EOF This is also expected. |
Beta Was this translation helpful? Give feedback.
-
This is still highly problematic, empty YAML files throw an error, and the docs for 0.57 state:
Maybe making trivy automatically search for YAML files so this flag is obviated is the real answer??....I shouldn't need to write lots of extra logic in all of my pipelines to handle this surely? |
Beta Was this translation helpful? Give feedback.
-
Description
We use
--ignorefile ./.trivyignore.yaml
in our common pipeline definition file in Gitlab as this is the only way of selecting the YAML format (we like the statements), however since the commit for #7624 landed in 0.57, things break horribly when this file is missing.Print a warning (including if the file is empty!) by all means, but this significant breaking change stops all of our CI where the ignore file isn't necessary (yet).
This is happening for both fs and image scans at least.
Desired Behavior
Print a warning, don't just break every pipeline out there!
Actual Behavior
2024-11-01T21:17:09Z FATAL Fatal error filter error: filtering error: ./.trivyignore.yaml error: ./.trivyignore.yaml parse error: yaml decode error: EOF
Reproduction Steps
Target
None
Scanner
Vulnerability
Output Format
None
Mode
Standalone
Debug Output
Operating System
aquasecurity Docker Container
Version
Checklist
trivy clean --all
Beta Was this translation helpful? Give feedback.
All reactions