From 7e2825d478cd31fb8d99db7f113b60c5480ece56 Mon Sep 17 00:00:00 2001 From: Dave Henderson Date: Fri, 10 May 2024 20:56:46 -0400 Subject: [PATCH] build(ci): enable trivy scan in CI Signed-off-by: Dave Henderson --- .github/workflows/trivy.yml | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/trivy.yml diff --git a/.github/workflows/trivy.yml b/.github/workflows/trivy.yml new file mode 100644 index 00000000..43bf3bbe --- /dev/null +++ b/.github/workflows/trivy.yml @@ -0,0 +1,41 @@ +name: Trivy Scan +on: + push: + branches: [ main ] + tags: [ 'v*' ] + pull_request: + branches: [ main ] + +jobs: + trivy: + permissions: + security-events: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run Trivy vulnerability scanner (table output) + uses: aquasecurity/trivy-action@master + with: + scan-type: fs + format: table + exit-code: 1 + ignore-unfixed: true + vuln-type: os,library + severity: CRITICAL,HIGH + - name: Run Trivy vulnerability scanner + uses: aquasecurity/trivy-action@master + with: + scan-type: fs + # The SARIF format ignores severity and uploads all vulnerabilities for + # later triage. The table-format step above is used to fail the build if + # there are any critical or high vulnerabilities. + # See https://github.com/aquasecurity/trivy-action/issues/95 + format: sarif + output: trivy-results.sarif + ignore-unfixed: true + vuln-type: os,library + - name: Upload Trivy scan results to GitHub Security tab + if: always() && github.repository == 'hairyhenderson/go-fsimpl' + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: 'trivy-results.sarif'