From d7812c1ed53a5b773da4d227e746247ff8947462 Mon Sep 17 00:00:00 2001 From: Robert Waffen Date: Tue, 5 Sep 2023 18:05:18 +0200 Subject: [PATCH] add trivy container scanning in ci --- .github/workflows/ci.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 67c86c0d..d64b2dd4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -50,12 +50,28 @@ jobs: name: 'Built test Docker image' runs-on: ubuntu-latest permissions: + actions: read contents: read + security-events: write steps: - name: Checkout repository uses: actions/checkout@v4 + - name: Build Docker image uses: docker/build-push-action@v4 with: context: . + tags: 'ci/hdm:${{ github.sha }}' push: false + + - name: Run Trivy vulnerability scanner + uses: aquasecurity/trivy-action@master + with: + image-ref: 'ci/hdm:${{ github.sha }}' + format: 'sarif' + output: 'trivy-results.sarif' + + - name: Upload Trivy scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: 'trivy-results.sarif'