Skip to content

exit-code with SARIF format doesn't respect the 'severity' parameter #309

@v-starodubov

Description

@v-starodubov

Hello,

I'm trying to construct a scan step with Trivy action and have faced an issue when the action uses exit-code when no intended severities are found because by default SARIF format enforces output of all vulnerabilities regardless of configured severities.
If limit-severities-for-sarif: true my pipeline works fine but I will get a stripped report file.

The goal is to get a full SARIF file and stop workflow (with exit-code) if only selected severities are found.

- name: Scan Docker image for vulnerabilities
  id: scan
  uses: aquasecurity/trivy-action@0.17.0
  with:
    input: /github/workspace/vault-init-image
    severity: 'HIGH,CRITICAL'
    exit-code: '1'
    format: 'sarif'
    limit-severities-for-sarif: false
    output: 'trivy-results.sarif'

In Workflow: https://github.com/Alpacked/security-hardening-helm/actions/runs/7916739186/job/21611265613

Resulted vulnerabilities from scan: image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions