-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exit code 1 not leading to a failed CI/CD when using format sarif #228
Comments
As mentioned in [this issue](aquasecurity/trivy-action#228) somehow the exit codes are not set correctly. Therefore, we are for now checking the scan results in an additional step
@rogercoll I just tested your latest commit and the bug with sarif + exit-code is still there. |
+1 – I have experienced the same problem for |
I can confirm that #247 solves the issue. |
This change moves the return code to outside the trivy call. This fixes #228 as the return code was not being propagated.
Found this bug again. It still shows when using |
We have been running trivy scans for different docker images on our github pipeline for a while using the following pattern:
We keep upgrading the version of the trivy action using the commit SHA.
Since a couple of updates we have realized that even if the scan finds HIGH/CRITICAL vulnerabilities, the step is not failed as expected using the exit-code = 1. We do see the vulnerability in the security tab and even the pipeline run linked in that page that produced that vulnerability, but the pipeline run did NOT fail as it used to do before.
We have run the pipeline locally with act and observed the exactly same behaviour. We came to the conclusion that as soon as the format "sarif" with an "output" are used, the exit-code is completely ignored.
This is not the case when running the trivy package itself on the very same image using the following command:
trivy image --exit-code 1 --severity HIGH,CRITICAL --format sarif -o trivy-results.sarif [image+tag]
This command returns an exit code of 1 if HIGH/CRITICAL vulnerabilities were found.
For now we are manually checking the sarif file and consequently producing an exit-code 1 if HIGH/CRITICAL vulnerabilities were found but it would be great if you could have a look.
Thanks a lot!
The text was updated successfully, but these errors were encountered: