Skip to content

Commit

Permalink
Use GitHub format
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydrogers committed Dec 11, 2024
1 parent 1f0b414 commit e3c2093
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions .github/workflows/action_publish-images-security-updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,26 @@ jobs:
outputs:
has_vulnerabilities: ${{ steps.scan.outputs.has_vulnerabilities || inputs.force_build }}
steps:
# Pretty output for logs
- id: scan-table
# Single scan for both vulnerabilities and dependencies
- id: scan
if: inputs.skip_scan != true
uses: aquasecurity/trivy-action@0.29.0
with:
image-ref: 'ghcr.io/serversideup/docker-ssh'
format: 'github'
output: 'trivy-results.json'
github-pat: ${{ secrets.GITHUB_TOKEN }}
ignore-unfixed: true
severity: 'CRITICAL,HIGH'
hide-progress: true
format: 'table' # Human readable output

# JSON scan for parsing
- id: scan-json
if: inputs.skip_scan != true
uses: aquasecurity/trivy-action@0.29.0
with:
image-ref: 'ghcr.io/serversideup/docker-ssh'
ignore-unfixed: true
severity: 'CRITICAL,HIGH'
hide-progress: true
format: 'json'
output: 'trivy-results.json' # Explicitly specify output file

# Parse Trivy results to set has_vulnerabilities
# Parse results to set has_vulnerabilities (for workflow control)
- if: inputs.skip_scan != true
id: parse
shell: bash
run: |
if [ -f trivy-results.json ]; then
VULN_COUNT=$(jq -r '[ .Results[] | select(.Vulnerabilities != null) | .Vulnerabilities[] ] | length // 0' trivy-results.json)
VULN_COUNT=$(jq -r '.vulnerabilities | length // 0' trivy-results.json)
if [ "${VULN_COUNT:-0}" -gt 0 ]; then
echo "has_vulnerabilities=true" >> "$GITHUB_OUTPUT"
else
Expand Down

0 comments on commit e3c2093

Please sign in to comment.