|
15 | 15 | with: |
16 | 16 | path: ~/.cache/trivy |
17 | 17 | key: callee-trivy-${{ github.workflow }}-${{ github.run_id }} |
18 | | - restore-keys: trivy- |
| 18 | + restore-keys: callee-trivy-${{ github.workflow }}- |
19 | 19 | - name: Run Trivy vulnerability scanner in repo mode |
20 | | - uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 |
| 20 | + uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # v0.35.0 |
21 | 21 | with: |
22 | 22 | scan-type: fs |
23 | 23 | scan-ref: "." |
|
29 | 29 | timeout: 10m0s |
30 | 30 | scanners: vuln,secret,config |
31 | 31 | - name: Upload Trivy scan results to GitHub Security tab |
32 | | - uses: github/codeql-action/upload-sarif@v3 |
| 32 | + uses: github/codeql-action/upload-sarif@v4 |
33 | 33 | with: |
34 | 34 | sarif_file: trivy-results.sarif |
35 | 35 | category: trivy-code-scan |
|
38 | 38 | with: |
39 | 39 | name: trivy-results |
40 | 40 | path: trivy-results.sarif |
| 41 | + |
| 42 | + scan-containers: |
| 43 | + runs-on: ubuntu-latest |
| 44 | + timeout-minutes: 60 |
| 45 | + strategy: |
| 46 | + fail-fast: false |
| 47 | + matrix: |
| 48 | + include: |
| 49 | + - image: cas-reg-backend |
| 50 | + category: trivy-container-backend |
| 51 | + - image: cas-reg-frontend |
| 52 | + category: trivy-container-registration |
| 53 | + - image: cas-admin-frontend |
| 54 | + category: trivy-container-administration |
| 55 | + - image: cas-compliance-frontend |
| 56 | + category: trivy-container-compliance |
| 57 | + - image: cas-dash-frontend |
| 58 | + category: trivy-container-dashboard |
| 59 | + - image: cas-rep-frontend |
| 60 | + category: trivy-container-reporting |
| 61 | + steps: |
| 62 | + - name: Checkout code |
| 63 | + uses: actions/checkout@v6 |
| 64 | + - name: Cache Scan Dependencies |
| 65 | + uses: actions/cache@v4 |
| 66 | + with: |
| 67 | + path: ~/.cache/trivy |
| 68 | + key: callee-trivy-${{ github.workflow }}-${{ github.run_id }} |
| 69 | + restore-keys: callee-trivy-${{ github.workflow }}- |
| 70 | + - name: Run Trivy vulnerability scanner on container image |
| 71 | + uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # v0.35.0 |
| 72 | + with: |
| 73 | + scan-type: image |
| 74 | + image-ref: ghcr.io/bcgov/${{ matrix.image }}:${{ github.sha }} |
| 75 | + format: sarif |
| 76 | + output: trivy-container-results.sarif |
| 77 | + exit-code: "0" |
| 78 | + ignore-unfixed: false |
| 79 | + severity: CRITICAL,HIGH,MEDIUM |
| 80 | + timeout: 10m0s |
| 81 | + - name: Upload Trivy container scan results to GitHub Security tab |
| 82 | + uses: github/codeql-action/upload-sarif@v4 |
| 83 | + with: |
| 84 | + sarif_file: trivy-container-results.sarif |
| 85 | + category: ${{ matrix.category }} |
| 86 | + - name: Upload Trivy container scan results as artifact |
| 87 | + uses: actions/upload-artifact@v4 |
| 88 | + with: |
| 89 | + name: trivy-container-results-${{ matrix.image }} |
| 90 | + path: trivy-container-results.sarif |
0 commit comments