-
Notifications
You must be signed in to change notification settings - Fork 29
125 lines (110 loc) · 4.03 KB
/
trivy-workflow.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: SEC - Container Scan - Trivy
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
trivy_web_container:
name: AquaSec Trivy Web Container Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build the Web container image
working-directory: ./Application-Source-Code
run: docker build . --tag localbuild/webimage:latest --file src/Web/Dockerfile
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
scan-type: 'image'
image-ref: 'localbuild/webimage:latest'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL' #UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL
format: 'table'
- name: Generate SARIF Report
uses: aquasecurity/trivy-action@master
if: ${{ success() || failure() }}
with:
scan-type: 'image'
image-ref: 'localbuild/webimage:latest'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL'
format: 'sarif'
output: 'trivy-web-container-results.sarif'
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
if: ${{ always() }}
with:
sarif_file: 'trivy-web-container-results.sarif'
trivy_api_container:
name: AquaSec Trivy API Container Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build the API container image
working-directory: ./Application-Source-Code
run: docker build . --tag localbuild/apiimage:latest --file src/PublicApi/Dockerfile
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
scan-type: 'image'
image-ref: 'localbuild/apiimage:latest'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL' #UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL
format: 'table'
- name: Generate SARIF Report
uses: aquasecurity/trivy-action@master
if: ${{ always() }}
with:
scan-type: 'image'
image-ref: 'localbuild/apiimage:latest'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL'
format: 'sarif'
output: 'trivy-api-container-results.sarif'
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
if: ${{ always() }}
with:
sarif_file: 'trivy-api-container-results.sarif'
trivy_iac:
name: AquaSec Trivy IaC Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run Trivy vulnerability scanner in IaC mode
uses: aquasecurity/trivy-action@master
with:
scan-type: 'config'
scan-ref: ./Infrastructure-Source-Code/terraform/azure
hide-progress: false
format: 'table'
exit-code: '1'
ignore-unfixed: true
severity: 'UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL'
- name: Generate SARIF Report
uses: aquasecurity/trivy-action@master
if: ${{ always() }}
with:
scan-type: 'config'
scan-ref: ./Infrastructure-Source-Code/terraform/azure
hide-progress: false
format: 'sarif'
exit-code: '1'
ignore-unfixed: true
severity: 'UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL'
output: 'trivy-iac-results.sarif'
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
if: ${{ always() }}
with:
sarif_file: 'trivy-iac-results.sarif'