-
Notifications
You must be signed in to change notification settings - Fork 247
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
Trivy is failing on sarif mode #386
Comments
I am having the same issue with a configuration like this:
Works when running in other formats. |
Yeah, fine in other formats, error only happened in sarif mode. It's weird. |
Hi @khantnaingset-kns ! Are you encountering a issue with the latest version of action (0.26)? |
The issue still happens in version .28 |
Still the same on version 28. |
same issue on v29 |
Works for me since jobs:
trivy-analysis:
name: Trivy Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run Trivy vulnerability scanner on built YAML files
uses: aquasecurity/trivy-action@0.28.0
with:
scan-type: "config"
scan-ref: "."
format: "sarif"
output: "trivy-results.sarif"
trivyignores: .trivyignore.yaml
trivy-config: trivy.yaml
severity: "CRITICAL,HIGH"
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: "trivy-results.sarif" My scan:
skip-files: []
skip-dirs: []
severity:
- HIGH
- CRITICAL And my misconfigurations:
- id: AVD-KSV-0011
statement: ""
- id: AVD-KSV-0020
statement: ""
- id: AVD-KSV-0021
statement: ""
- id: AVD-KSV-0014
paths: []
statement: "" Note that I'm using |
I think this is the issue: https://github.com/aquasecurity/trivy-action/blob/master/entrypoint.sh#L33 Here is some testing: ❯ export INPUT_IMAGE_REF=node:23.2.0-alpine3.20
❯ export TRIVY_FORMAT=sarif
❯ export TRIVY_SEVERITY=CRITICAL,HIGH
❯ export TRIVY_QUIET=true
❯ export TRIVY_EXIT_CODE=1
❯ if ./entrypoint.sh > /dev/null; then echo pass; else echo fail; fi
fail
❯ export INPUT_LIMIT_SEVERITIES_FOR_SARIF=true
❯ if ./entrypoint.sh > /dev/null; then echo pass; else echo fail; fi
pass The previous version of this code used this check: Line 190 in 1b8b83d
Which would be true only when the var was "true", but now an unset var is also considered true. The proper fix is to specify the input - uses: aquasecurity/trivy-action@0.29.0
with:
image-ref: node:23.2.0-alpine3.20
severity: CRITICAL,HIGH
exit-code: 1
format: sarif
limit-severities-for-sarif: true |
I'm experiencing an issue with Trivy when running it in SARIF mode. Unfortunately, I'm not seeing any error logs, making it difficult to troubleshoot. To investigate further, I switched to Table mode, which allowed me to view more logs. The step completed successfully in Table mode, no errors logs. However, when I switched back to SARIF mode, the step failed again. I'm puzzled as to why this is happening and would appreciate an explanation.
Outputs for sarif mode:
Code for sarif mode:
Outputs for Table mode:
Code for Table mode:
The text was updated successfully, but these errors were encountered: