forked from SocialGouv/dashlord
-
Notifications
You must be signed in to change notification settings - Fork 0
312 lines (281 loc) · 9.59 KB
/
scans.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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
name: DashLord scans
on:
workflow_dispatch:
inputs:
url:
description: "Single url to scan or scan all urls"
required: false
default: ""
tool:
description: "Single tool to run or use all tools"
type: choice
default: all
options:
- all
- codescan
- dependabot
- ecoindex
- lighthouse
- sonarcloud
- trivy
- zap
push:
branches:
- master
- main
paths:
- "dashlord.yaml"
- "dashlord.yml"
- "urls.txt"
schedule:
- cron: "0 0 * * 0" # see https://crontab.guru
# allow only one concurrent scan action
concurrency:
cancel-in-progress: true
group: scans
jobs:
init:
runs-on: ubuntu-latest
name: Prepare
outputs:
sites: ${{ steps.init.outputs.sites }}
config: ${{ steps.init.outputs.config }}
steps:
- uses: actions/checkout@v3
- id: init
uses: "SocialGouv/dashlord-actions/init@v1"
with:
url: ${{ github.event.inputs.url }}
tool: ${{ github.event.inputs.tool }}
scans:
runs-on: ubuntu-latest
name: Scan
needs: init
continue-on-error: true
strategy:
fail-fast: false
max-parallel: 3
matrix:
sites: ${{ fromJson(needs.init.outputs.sites) }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- run: |
mkdir scans
- uses: actions/cache@v2
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: sonarcloud scan
if: ${{ matrix.sites.tools.sonarcloud }}
id: sonarcloud
continue-on-error: true
timeout-minutes: 10
uses: SocialGouv/dashlord-actions/sonarcloud@v1
with:
repos: ${{ join(matrix.sites.repositories) }}
output: "scans/sonarcloud.json"
- name: Third-party scripts scan
if: ${{ matrix.sites.tools.thirdparties }}
id: thirdparties
continue-on-error: true
timeout-minutes: 10
uses: SocialGouv/thirdparties-action@master
with:
url: "${{ matrix.sites.url }}"
output: "scans/thirdparties.json"
- name: Déclaration a11y
timeout-minutes: 10
uses: "socialgouv/dashlord-actions/declaration-a11y@v1"
if: ${{ matrix.sites.tools['declaration-a11y'] }}
with:
url: ${{ matrix.sites.url }}
output: scans/declaration-a11y.json
- name: eco-index
continue-on-error: true
timeout-minutes: 10
uses: "socialgouv/dashlord-actions/ecoindex@v1"
if: ${{ matrix.sites.tools.ecoindex }}
with:
url: ${{ matrix.sites.url }}
output: scans/ecoindex.json
- name: Déclaration RGPD
timeout-minutes: 10
uses: SocialGouv/dashlord-actions/declaration-rgpd@v1
if: ${{ matrix.sites.tools['declaration-rgpd'] }}
with:
thirdparties: ${{ steps.thirdparties.outputs.json }}
url: ${{ matrix.sites.url }}
output: scans/declaration-rgpd.json
- name: Trivy
continue-on-error: true
timeout-minutes: 20
if: ${{ matrix.sites.tools.trivy && matrix.sites.docker }}
uses: "socialgouv/dashlord-actions/trivy@v1"
with:
images: ${{ join(matrix.sites.docker) }}
output: scans/trivy.json
- name: Detect 404s
continue-on-error: true
timeout-minutes: 10
uses: "socialgouv/detect-404-action@master"
if: ${{ matrix.sites.tools['404'] }}
with:
url: ${{ matrix.sites.url }}
output: scans/404.json
- name: Betagouv API scan
if: ${{ matrix.sites.tools.betagouv }}
continue-on-error: true
timeout-minutes: 10
id: betagouv
uses: betagouv/dashlord-startup-action@main
with:
id: "${{ matrix.sites.betaId }}"
output: "scans/betagouv.json"
- name: Stats page
timeout-minutes: 10
uses: "betagouv/check-url-action@main"
if: ${{ matrix.sites.tools.stats }}
with:
url: ${{ steps.betagouv.outputs.stats_url || format('{0}/stats', matrix.sites.url) }}
output: scans/stats.json
minExpectedRegex: ^stat
exactExpectedRegex: ^stats$
- name: Screenshot Website
uses: swinton/[email protected]
if: ${{ matrix.sites.tools.screenshot }}
timeout-minutes: 5
continue-on-error: true
with:
source: "${{ matrix.sites.url }}"
type: jpeg
destination: screenshot.jpeg
width: 1280
scaleFactor: 0.5
- name: Wappalyzer scan
if: ${{ matrix.sites.tools.wappalyzer }}
uses: "socialgouv/wappalyzer-action@master"
timeout-minutes: 10
continue-on-error: true
with:
url: "${{ matrix.sites.url }}"
output: scans/wappalyzer.json
- name: ZAP Scan
if: ${{ matrix.sites.tools.zap }}
uses: zaproxy/[email protected]
timeout-minutes: 10
with:
token: "" # disable issue creation
rules_file_name: "zap-rules.tsv"
docker_name: "owasp/zap2docker-stable"
target: "${{ matrix.sites.url }}"
cmd_options: "-a"
allow_issue_writing: false
# https://github.com/treosh/lighthouse-ci-action#inputs
- name: Lighthouse scan
if: ${{ matrix.sites.tools.lighthouse }}
timeout-minutes: 10
uses: socialgouv/dashlord-actions/lhci@v1
with:
url: "${{ join(matrix.sites.subpages, ',') }}"
- name: Mozilla HTTP Observatory
if: ${{ matrix.sites.tools.http }}
timeout-minutes: 10
id: http
continue-on-error: true
uses: SocialGouv/httpobs-action@master
with:
url: "${{ matrix.sites.url }}"
output: "scans/http.json"
- name: Mozilla HTTP Observatory retry
if: steps.http.outcome=='failure'
continue-on-error: true
timeout-minutes: 10
uses: SocialGouv/httpobs-action@master
with:
url: "${{ matrix.sites.url }}"
output: "scans/http.json"
# testssl.sh action needs an hostname to save its output so we build it here
- name: Extract hostname
id: hostname
run: |
HOSTNAME=$(echo "${{ matrix.sites.url }}" | sed -e 's/[^/]*\/\/\([^@]*@\)\?\([^:/]*\).*/\2/')
echo "::set-output name=value::$HOSTNAME"
- name: testssl.sh scan
if: ${{ matrix.sites.tools.testssl }}
timeout-minutes: 10
continue-on-error: true
uses: "mbogh/[email protected]"
with:
host: ${{ steps.hostname.outputs.value }}
output: scans
grade: "F"
options: "--fast"
- name: Nuclei scan
if: ${{ matrix.sites.tools.nuclei }}
timeout-minutes: 10
continue-on-error: true
uses: "SocialGouv/dashlord-nuclei-action@master"
with:
url: ${{ matrix.sites.url }}
output: "scans/nuclei.log"
- name: Updown.io checks
if: ${{ matrix.sites.tools.updownio }}
continue-on-error: true
uses: "MTES-MCT/updownio-action@main"
with:
apiKey: ${{ secrets.UPDOWNIO_API_KEY }}
url: ${{ matrix.sites.url }}
output: scans/updownio.json
- name: Dependabot vulnerabilities alerts
if: ${{ matrix.sites.tools.dependabot && matrix.sites.repositories }}
continue-on-error: true
uses: "MTES-MCT/dependabotalerts-action@main"
with:
token: ${{ secrets.DEPENDABOTALERTS_TOKEN }}
repositories: ${{ join(matrix.sites.repositories) }}
output: scans/dependabotalerts.json
- name: Code quality alerts
if: ${{ matrix.sites.tools.codescan && matrix.sites.repositories }}
continue-on-error: true
uses: "MTES-MCT/codescanalerts-action@main"
with:
token: ${{ secrets.CODESCANALERTS_TOKEN }}
repositories: ${{ join(matrix.sites.repositories) }}
output: scans/codescanalerts.json
- uses: SocialGouv/dashlord-actions/save@v1
with:
url: ${{ matrix.sites.url }}
# only clean up previous stats when all tools runned
cleanup: ${{ github.event.inputs.tool == 'all' && true || false }}
- name: "Commit"
id: commit1
continue-on-error: true
run: |
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
git config --global user.name GitHub
git add "results"
git commit -m "update: ${{ matrix.sites.url }}"
git pull --rebase --no-ff origin ${{ github.ref }}
git push
- name: "Commit retry"
if: steps.commit1.outcome=='failure'
id: commit2
continue-on-error: true
run: |
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
git config --global user.name GitHub
git add "results"
git commit -m "update: ${{ matrix.sites.url }}"
git pull --rebase --no-ff origin ${{ github.ref }}
git push
- name: "Commit retry 2"
if: steps.commit2.outcome=='failure'
run: |
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
git config --global user.name GitHub
git add "results"
git commit -m "update: ${{ matrix.sites.url }}"
git pull --rebase --no-ff origin ${{ github.ref }}
git push