From 3684e25c7d818df6836384bcca3b05b2645adcab Mon Sep 17 00:00:00 2001 From: Raul Zamora Date: Fri, 26 Jul 2024 14:29:40 +0200 Subject: [PATCH] add trivy workflow --- .github/workflows/trivy.yaml | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/trivy.yaml diff --git a/.github/workflows/trivy.yaml b/.github/workflows/trivy.yaml new file mode 100644 index 0000000..9febf3f --- /dev/null +++ b/.github/workflows/trivy.yaml @@ -0,0 +1,41 @@ +name: Trivy Security Scanner +on: + push: + branches: + - 3-22.04 + pull_request: +jobs: + build: + uses: ./.github/workflows/build.yaml + scan: + name: Trivy scan + needs: build + runs-on: ubuntu-20.04 + steps: + - name: Checkout code + uses: actions/checkout@v3 + - name: Install dependencies + run: | + sudo snap install rockcraft --classic --edge + - uses: actions/download-artifact@v3 + with: + name: charmed-karapace + - name: Import locally + run: | + sudo rockcraft.skopeo --insecure-policy copy \ + oci-archive:${{ needs.build.outputs.rock }} \ + docker-daemon:trivy/charmed-karapace:test + + - name: Run Trivy vulnerability scanner + uses: aquasecurity/trivy-action@master + with: + image-ref: 'trivy/charmed-karapace:test' + format: 'sarif' + output: 'trivy-results.sarif' + severity: 'MEDIUM,HIGH,CRITICAL' + + - name: Upload Trivy scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v2 + if: always() + with: + sarif_file: 'trivy-results.sarif'