Skip to content

Commit e00bb68

Browse files
nit on trivy workflow
1 parent 7c90472 commit e00bb68

2 files changed

Lines changed: 14 additions & 11 deletions

File tree

.github/workflows/trivy-vulnerability-triage.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,28 +44,23 @@ jobs:
4444
uses: aquasecurity/trivy-action@master
4545
with:
4646
image-ref: "${{ env.IMAGE }}:${{ inputs.image_tag || 'latest' }}"
47-
format: "json"
48-
output: "trivy-results.json"
49-
severity: "CRITICAL,HIGH,MEDIUM"
50-
# Only report vulns that have a fix available
51-
ignore-unfixed: true
47+
format: "table"
48+
output: "trivy-results.txt"
5249
trivy-config: trivy.yaml
53-
50+
5451
- name: Check for vulnerabilities
5552
id: check
5653
run: |
57-
VULN_COUNT=$(jq '[.Results[]?.Vulnerabilities // [] | .[] | select(.FixedVersion != null and .FixedVersion != "")] | length' trivy-results.json)
58-
echo "Found $VULN_COUNT fixable vulnerabilities"
59-
if [ "$VULN_COUNT" -gt 0 ]; then
54+
if [ -s trivy-results.txt ] && grep -qE "Total: [1-9]" trivy-results.txt; then
6055
echo "has_vulnerabilities=true" >> "$GITHUB_OUTPUT"
6156
else
6257
echo "has_vulnerabilities=false" >> "$GITHUB_OUTPUT"
6358
fi
64-
59+
6560
- name: Upload scan results
6661
if: steps.check.outputs.has_vulnerabilities == 'true'
6762
uses: actions/upload-artifact@v4
6863
with:
6964
name: trivy-results
70-
path: trivy-results.json
65+
path: trivy-results.txt
7166
retention-days: 30

trivy.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,11 @@ scan:
77
pkg-types:
88
- os
99
- library
10+
11+
severity:
12+
- CRITICAL
13+
- HIGH
14+
- MEDIUM
15+
16+
vulnerability:
17+
ignore-unfixed: true

0 commit comments

Comments
 (0)