diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml index 8e0c7192..91ad9c85 100644 --- a/.github/workflows/common.yml +++ b/.github/workflows/common.yml @@ -48,19 +48,14 @@ jobs: if: ${{ inputs.enableSecurityScan && github.repository == 'spring-cloud/stream-applications' }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - 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' + exit-code: 1 - name: 'Scanned' shell: bash run: echo "::info ::Scanned" diff --git a/scan-jar.sh b/scan-jar.sh index bd586d47..284f04a1 100755 --- a/scan-jar.sh +++ b/scan-jar.sh @@ -5,7 +5,7 @@ if [[ "$1" != *"-sources.jar" ]] && [[ "$1" != *"-javadoc.jar" ]]; then if [ "$TRIVY_UPLOAD" == "true" ]; then echo "Scanning:$1" echo "trivy rootfs --format sarif -o \"$1.sarif\" \"$1\"" - trivy rootfs --format sarif -o "$1.sarif" "$1" + trivy rootfs --exit-code 1 --format sarif -o "$1.sarif" "$1" if [ -f "$1.sarif" ]; then if [ -f $SCDIR/runs.sarif ]; then echo "," >> "$SCDIR/runs.sarif" @@ -15,7 +15,7 @@ if [[ "$1" != *"-sources.jar" ]] && [[ "$1" != *"-javadoc.jar" ]]; then echo "Could not find:$1.sarif" fi else - trivy rootfs -q "$1" + trivy rootfs --exit-code 1 -q "$1" fi else if [ "$TRIVY_UPLOAD" == "true" ]; then