-
Notifications
You must be signed in to change notification settings - Fork 59
147 lines (130 loc) · 4.4 KB
/
trivy.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: Trivy
on:
schedule:
- cron: "0 0 * * *"
- cron: "0 23 * * *"
pull_request:
branches:
- main
- 'maint-**'
workflow_dispatch:
inputs:
branch:
description: 'branch to run scans on'
default: 'main'
type: string
env:
BUILD_TYPE: Release
MTL_BUILD_DISABLE_PCAPNG: true
PREFIX_DIR: /usr/local
DEBIAN_FRONTEND: noninteractive
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db
TRIVY_JAVA_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-java-db
permissions:
contents: read
jobs:
triv-security-tab:
name: sarif output scan
runs-on: ubuntu-22.04
permissions:
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
steps:
- name: Checkout code
if: github.event_name == 'schedule' && github.event.schedule == '0 23 * * *'
uses: actions/checkout@v4
with:
ref: maint-25.02 # tmp branch
- name: Checkout code
if: github.event_name == 'schedule' && github.event.schedule == '0 0 * * *'
uses: actions/checkout@v4
with:
ref: main
- name: Checkout code
if: github.event_name != 'schedule'
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Run Trivy vulnerability scanner with sarif output
uses: aquasecurity/trivy-action@915b19bbe73b92a6cf82a1bc12b087c9a19a5fe2 # v0.28.0
with:
scan-type: config
scan-ref: ./docker
format: sarif
exit-code: 0
vuln-type: os,library
output: Trivy-dockerfile.sarif
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9
with:
sarif_file: Trivy-dockerfile.sarif
triv-security-tab-manager:
name: manager sarif output scan
runs-on: ubuntu-22.04
permissions:
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
steps:
- name: Checkout code
if: github.event_name == 'schedule' && github.event.schedule == '0 23 * * *'
uses: actions/checkout@v4
with:
ref: maint-25.02 # tmp branch
- name: Checkout code
if: github.event_name == 'schedule' && github.event.schedule == '0 0 * * *'
uses: actions/checkout@v4
with:
ref: main
- name: Checkout code
if: github.event_name != 'schedule'
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Run Trivy vulnerability scanner with sarif output
uses: aquasecurity/trivy-action@915b19bbe73b92a6cf82a1bc12b087c9a19a5fe2 # v0.28.0
with:
scan-type: config
scan-ref: ./manager
format: sarif
exit-code: 0
vuln-type: os,library
output: Trivy-manager-dockerfile.sarif
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9
with:
sarif_file: Trivy-manager-dockerfile.sarif
trivy-stdout:
name: table output scan
runs-on: ubuntu-22.04
steps:
- name: Checkout code
if: github.event_name == 'schedule' && github.event.schedule == '0 23 * * *'
uses: actions/checkout@v4
with:
ref: maint-25.02 # tmp branch
- name: Checkout code
if: github.event_name == 'schedule' && github.event.schedule == '0 0 * * *'
uses: actions/checkout@v4
with:
ref: main
- name: Checkout code
if: github.event_name != 'schedule'
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Run Trivy vulnerability scanner with table output
uses: aquasecurity/trivy-action@915b19bbe73b92a6cf82a1bc12b087c9a19a5fe2 # v0.28.0
with:
scan-type: config
scan-ref: ./docker
cache: false
format: table
exit-code: 1
vuln-type: os,library
- name: Run Trivy manager vulnerability scanner with table output
uses: aquasecurity/trivy-action@915b19bbe73b92a6cf82a1bc12b087c9a19a5fe2 # v0.28.0
with:
scan-type: config
scan-ref: ./manager
cache: false
format: table
exit-code: 1
vuln-type: os,library