From 0db29a674f6add6636e7b814487dde7b016e8dec Mon Sep 17 00:00:00 2001 From: Chris Bono Date: Fri, 6 Oct 2023 21:50:50 -0500 Subject: [PATCH] [CI] Add Trivy vulnerability scans Adds Trivy vulnerability scan jobs to both CI and PR workflows. Resolves #466 --- .github/workflows/ci-pr.yml | 21 +++++++++++++++++++++ .github/workflows/ci.yml | 26 ++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-pr.yml b/.github/workflows/ci-pr.yml index 3302845d..f83e14bc 100644 --- a/.github/workflows/ci-pr.yml +++ b/.github/workflows/ci-pr.yml @@ -40,3 +40,24 @@ jobs: name: test-results path: '*/build/reports/tests/**/*.*' retention-days: 3 + scan: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Run Trivy vulnerability scanner in repo mode + uses: aquasecurity/trivy-action@master + with: + scan-type: 'fs' + ignore-unfixed: true + format: 'table' + severity: 'CRITICAL,HIGH' + - name: 'Scanned' + shell: bash + run: echo "::info ::Scanned" + done: + runs-on: ubuntu-latest + needs: [ build_and_verify, scan ] + steps: + - name: 'Done' + shell: bash + run: echo "::info ::Done" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ddedf88..8c662b31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,9 +83,31 @@ jobs: -PlocalRepositoryPath="$LOCAL_REPOSITORY_PATH" \ -PspringPulsarVersion="$VERSION" \ :runAllSampleTests + scan: + name: Run Trivy Scan + needs: [prerequisites] + runs-on: ubuntu-latest + if: needs.prerequisites.outputs.runjobs + steps: + - uses: actions/checkout@v3 + - name: Run Trivy vulnerability scanner in repo mode + uses: aquasecurity/trivy-action@master + with: + scan-type: 'fs' + ignore-unfixed: true + format: 'sarif' + output: 'trivy-results.sarif' + severity: 'CRITICAL,HIGH' + - name: Upload Trivy scan results to GitHub Security tab + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: 'trivy-results.sarif' + - name: 'Scanned' + shell: bash + run: echo "::info ::Scanned" deploy_artifacts: name: Deploy Artifacts - needs: [build_jdk_17, check_samples] + needs: [build_jdk_17, check_samples, scan] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -103,7 +125,7 @@ jobs: -PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD" deploy_docs_antora: name: Deploy Antora Docs - needs: [build_jdk_17, check_samples] + needs: [build_jdk_17, check_samples, scan] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3