diff --git a/.github/workflows/trivy-scan.yml b/.github/workflows/trivy-scan.yml new file mode 100644 index 0000000..1ef18ac --- /dev/null +++ b/.github/workflows/trivy-scan.yml @@ -0,0 +1,39 @@ +name: trivy + +on: + workflow_dispatch: + pull_request: + branches: + - main + push: + branches: + - main + schedule: + - cron: "0 0 * * *" +jobs: + trivy-scan: + name: Trivy IaC scan + runs-on: ubuntu-latest + permissions: + contents: read # for actions/checkout to fetch code + security-events: write # for github/codeql-action/upload-sarif to upload SARIF results + actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Run Trivy vulnerability scanner in IaC mode + uses: aquasecurity/trivy-action@master + with: + scan-type: 'fs' + hide-progress: false + scan-ref: '.' + format: 'sarif' + output: 'trivy-results.sarif' + scanners: 'vuln,secret,config' + ignore-unfixed: true + #severity: 'CRITICAL,HIGH' + - name: Upload Trivy scan results to GitHub Security tab + continue-on-error: true # TODO: remove once https://github.com/aquasecurity/tfsec/issues/1955 is resolved + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: 'trivy-results.sarif'