File tree Expand file tree Collapse file tree 5 files changed +132
-50
lines changed Expand file tree Collapse file tree 5 files changed +132
-50
lines changed Original file line number Diff line number Diff line change 1+ # https://github.com/anchore/grype
2+ # https://github.com/anchore/scan-action
3+
4+ name : Anchore Grype Vulnerability Scan (Container Image Scanning)
5+
6+ on :
7+ push :
8+ branches : [main]
9+ pull_request :
10+ branches : [main]
11+ schedule :
12+ - cron : 0 1 * * 0
13+
14+ env :
15+ fail-build : false # Set to true to fail the build if vulnerabilities are found
16+ imageName : " webapp01"
17+ tag : ${{ github.sha }}
18+
19+ permissions :
20+ contents : read # for actions/checkout to fetch code
21+ security-events : write # for github/codeql-action/upload-sarif to upload SARIF results
22+ actions : read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
23+
24+ jobs :
25+ anchore-grype-scan :
26+ name : Anchore Grype Vulnerability Scan
27+
28+ runs-on : ubuntu-latest
29+
30+ steps :
31+ - name : Checkout code
32+ uses : actions/checkout@v4
33+
34+ - name : Build an image from Dockerfile
35+ uses : docker/build-push-action@v4
36+ with :
37+ context : ./src/webapp01
38+ file : ./src/webapp01/Dockerfile
39+ tags : " ${{ env.imageName }}:${{ env.tag }}"
40+ push : false
41+ load : true
42+
43+ - name : Run the Anchore Grype scan action
44+ uses : anchore/scan-action@v6
45+ id : scan
46+ with :
47+ image : " ${{ env.imageName }}:${{ env.tag }}"
48+ fail-build : ${{ env.fail-build }}
49+ severity-cutoff : critical
50+
51+ - name : Upload Anchore vulnerability report to GitHub Security tab
52+ uses : github/codeql-action/upload-sarif@v3
53+ with :
54+ sarif_file : ${{ steps.scan.outputs.sarif }}
Original file line number Diff line number Diff line change 1+ # https://trivy.dev/latest/
2+ # https://github.com/aquasecurity/trivy
3+ # https://github.com/aquasecurity/trivy-action
4+
5+ name : Trivy Container Image Scanning
6+
7+ on :
8+ push :
9+ branches : [main]
10+ pull_request :
11+ branches : [main]
12+ schedule :
13+ - cron : 0 1 * * 0
14+
15+ env :
16+ imageName : " webapp01"
17+ tag : ${{ github.sha }}
18+
19+ permissions :
20+ contents : read # for actions/checkout to fetch code
21+ security-events : write # for github/codeql-action/upload-sarif to upload SARIF results
22+ actions : read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
23+
24+ jobs :
25+ trivy :
26+ name : Trivy vulnerability scanner
27+
28+ runs-on : ubuntu-latest
29+
30+ steps :
31+ - name : Checkout code
32+ uses : actions/checkout@v4
33+
34+ - name : Build an image from Dockerfile
35+ run : |
36+ docker build ./src/webapp01 --file ./src/webapp01/Dockerfile --tag ${{ env.imageName }}:${{ env.tag }}
37+
38+ - name : Run Trivy vulnerability scanner
39+ uses : aquasecurity/trivy-action@0.29.0
40+ with :
41+ image-ref : " ${{ env.imageName }}:${{ env.tag }}"
42+ format : " sarif"
43+ output : " trivy-results.sarif"
44+
45+ - name : Upload Trivy scan results to GitHub Security tab
46+ uses : github/codeql-action/upload-sarif@v3
47+ if : always()
48+ with :
49+ sarif_file : " trivy-results.sarif"
Original file line number Diff line number Diff line change 1- name : " CodeQL Advanced"
1+ name : " SAST - Code Scanning - CodeQL Advanced"
22
33on :
44 push :
2020 permissions :
2121 # required for all workflows
2222 security-events : write
23-
2423 # required to fetch internal or private CodeQL packs
2524 packages : read
26-
2725 # only required for workflows in private repositories
2826 actions : read
2927 contents : read
Original file line number Diff line number Diff line change 1+ # Source repository: https://github.com/actions/dependency-review-action
2+ # Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
3+
4+ name : ' SCA - Dependency Review'
5+
6+ on :
7+ pull_request :
8+ branches : [ "main" ]
9+
10+ permissions :
11+ contents : read
12+ # Write permissions for pull-requests are required for using the `comment-summary-in-pr` option, comment out if you aren't using this option
13+ pull-requests : write
14+
15+ jobs :
16+ dependency-review :
17+ runs-on : ubuntu-latest
18+ steps :
19+ - name : ' Checkout repository'
20+ uses : actions/checkout@v4
21+ - name : ' Dependency Review'
22+ uses : actions/dependency-review-action@v4
23+ # Commonly enabled options, see https://github.com/actions/dependency-review-action#configuration-options for all available options.
24+ with :
25+ comment-summary-in-pr : always
26+ fail-on-severity : ' moderate'
27+ allow-licenses : MIT, Apache-2.0
28+
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments