File tree Expand file tree Collapse file tree 4 files changed +92
-2
lines changed Expand file tree Collapse file tree 4 files changed +92
-2
lines changed Original file line number Diff line number Diff line change 1+ name : Trivy Image Vulnerability Scan
2+
3+ on :
4+ workflow_dispatch :
5+ schedule :
6+ - cron : ' 0 18 * * 0' # Run every Monday at 6am NZST
7+
8+ permissions :
9+ contents : read
10+
11+ jobs :
12+ scan-image :
13+ name : Scan ${{ matrix.image }} image for vulnerabilities
14+ runs-on : ubuntu-latest
15+ strategy :
16+ fail-fast : true
17+ matrix :
18+ include :
19+ - image : mssql2017
20+ - image : mssql2019
21+ - image : mssql2022
22+ - image : php73
23+ - image : php74
24+ - image : php80
25+ - image : php81
26+ - image : php82
27+ - image : php83
28+ - image : php84
29+ permissions :
30+ contents : read
31+ security-events : write
32+ steps :
33+ - name : Pull image to scan
34+ run : docker pull ghcr.io/totara/docker-dev-${{ matrix.image }}
35+ - name : Run Trivy vulnerability scanner
36+ uses : aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 # v0.33.1
37+ with :
38+ image-ref : ghcr.io/totara/docker-dev-${{ matrix.image }}
39+ format : template
40+ template : ' @/contrib/sarif.tpl'
41+ output : trivy-results-${{ matrix.image }}-image.sarif
42+ severity : ' CRITICAL,HIGH'
43+ - name : Upload Trivy scan results to GitHub Security tab
44+ uses : github/codeql-action/upload-sarif@v4
45+ with :
46+ sarif_file : trivy-results-${{ matrix.image }}-image.sarif
Original file line number Diff line number Diff line change 1+ name : Trivy Repo Vulnerability Scan
2+
3+ on :
4+ push :
5+ branches :
6+ - master
7+ pull_request :
8+ branches :
9+ - master
10+
11+ permissions :
12+ contents : read
13+
14+ jobs :
15+ scan-repo :
16+ name : Scan repo for vulnerabilities
17+ runs-on : ubuntu-latest
18+ permissions :
19+ contents : read
20+ security-events : write
21+ steps :
22+ - name : Checkout code
23+ uses : actions/checkout@v4
24+ with :
25+ fetch-depth : 1
26+ - name : Run Trivy vulnerability scanner
27+ uses : aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 # v0.33.1
28+ with :
29+ scan-type : ' fs'
30+ scan-ref : ' .'
31+ ignore-unfixed : true
32+ format : ' sarif'
33+ output : ' trivy-results-repo.sarif'
34+ exit-code : ' 1'
35+ severity : ' CRITICAL,HIGH'
36+ - name : Upload Trivy scan results to GitHub Security tab
37+ uses : github/codeql-action/upload-sarif@v4
38+ if : always()
39+ with :
40+ sarif_file : ' trivy-results-repo.sarif'
Original file line number Diff line number Diff line change @@ -60,8 +60,11 @@ services:
6060 networks :
6161 - totara
6262
63- # When adding a new MSSQL container, make sure you also add entries in:
64- # compose/build.yml, .github/workflows/build-mssql.yml
63+ # When adding a new MSSQL container here, make sure you also:
64+ # - Add a build entry in compose/build.yml
65+ # - Add a CI build entry in .github/workflows/build-mssql.yml
66+ # - Add a image matrix entry in .github/workflows/scan-images.yml
67+ # - Update README.md
6568
6669volumes :
6770 mssql-data :
Original file line number Diff line number Diff line change @@ -378,6 +378,7 @@ services:
378378 # - Add a mutagen sync entry in compose/sync.yml
379379 # - Add relevant network aliases in compose/nginx.yml and compose/apache.yml
380380 # - Add a CI build entry in .github/workflows/build-php.yml
381+ # - Add a image matrix entry in .github/workflows/scan-images.yml
381382 # - Update the max PHP version in .github/workflows/validate-config.yml
382383 # - Update README.md
383384
You can’t perform that action at this time.
0 commit comments