Skip to content

Commit 234f8ea

Browse files
ci: update Testing workflow with harden-runner recommendations (#4114)
This commit updates the Testing workflow (testing.yml) using recommendations from Step Security's harden-runner action. Recommendations were taken from the most recent Testing workflow run (6232, see links below) where all jobs ran with only the 'Get Yesterday's cached database if today's is not available' step not running on relevant jobs. As harden-runner only runs on Ubuntu VMs, a job-level permission was added to the 'Windows long test' job to account for the removal of the top-level workflow permission. As the Build job has only recently been added, the `egress-policy` key has been left with the value `audit`. The harden-runner recommendations suggest changing the value to `block` after 10+ runs of the job. Reference issue #4111 Testing workflow run 6232: https://github.com/intel/cve-bin-tool/actions/runs/8976788790/job/24654326627 harden-runner recommendations: https://app.stepsecurity.io/github/intel/cve-bin-tool/actions/runs/ 8976788790?jobid=24654326273&tab=recommendations
1 parent 85267fa commit 234f8ea

File tree

1 file changed

+105
-5
lines changed

1 file changed

+105
-5
lines changed

.github/workflows/testing.yml

Lines changed: 105 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: Testing
2-
permissions: read-all
32

43
on:
54
push:
@@ -24,6 +23,8 @@ env:
2423
jobs:
2524
docs:
2625
name: Documentation
26+
permissions:
27+
contents: read
2728
if: |
2829
! github.event.pull_request.user.login == 'github-actions[bot]' ||
2930
! (
@@ -38,7 +39,12 @@ jobs:
3839
- name: Harden Runner
3940
uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1
4041
with:
41-
egress-policy: audit
42+
disable-sudo: true
43+
egress-policy: block
44+
allowed-endpoints: >
45+
files.pythonhosted.org:443
46+
github.com:443
47+
pypi.org:443
4248
4349
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
4450
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
@@ -59,6 +65,8 @@ jobs:
5965
6066
tests:
6167
name: Linux tests
68+
permissions:
69+
contents: read
6270
runs-on: ubuntu-22.04
6371
strategy:
6472
matrix:
@@ -68,7 +76,34 @@ jobs:
6876
- name: Harden Runner
6977
uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1
7078
with:
71-
egress-policy: audit
79+
egress-policy: block
80+
allowed-endpoints: >
81+
access.redhat.com:443
82+
archives.fedoraproject.org:443
83+
azure.archive.ubuntu.com:80
84+
curl.se:443
85+
epss.cyentia.com:443
86+
esm.ubuntu.com:443
87+
files.pythonhosted.org:443
88+
ftp.fr.debian.org:80
89+
github.com:443
90+
gitlab.com:443
91+
mirror.cveb.in:443
92+
mirror.cveb.in:80
93+
motd.ubuntu.com:443
94+
nvd.nist.gov:443
95+
osv-vulnerabilities.storage.googleapis.com:443
96+
packages.microsoft.com:443
97+
ppa.launchpadcontent.net:443
98+
pypi.org:443
99+
raw.githubusercontent.com:443
100+
release-monitoring.org:443
101+
rpmfind.net:443
102+
security-tracker.debian.org:443
103+
services.nvd.nist.gov:443
104+
storage.googleapis.com:443
105+
www.cisa.gov:443
106+
www.sqlite.org:443
72107
73108
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
74109
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
@@ -149,6 +184,8 @@ jobs:
149184
150185
long_tests:
151186
name: Long tests on Python 3.10
187+
permissions:
188+
contents: read
152189
if: |
153190
! github.event.pull_request.user.login == 'github-actions[bot]' ||
154191
! (
@@ -166,7 +203,39 @@ jobs:
166203
- name: Harden Runner
167204
uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1
168205
with:
169-
egress-policy: audit
206+
egress-policy: block
207+
allowed-endpoints: >
208+
access.redhat.com:443
209+
api.codecov.io:443
210+
api.github.com:443
211+
archives.fedoraproject.org:443
212+
azure.archive.ubuntu.com:80
213+
cli.codecov.io:443
214+
codecov.io:443
215+
curl.se:443
216+
epss.cyentia.com:443
217+
esm.ubuntu.com:443
218+
files.pythonhosted.org:443
219+
ftp.fr.debian.org:80
220+
github.com:443
221+
gitlab.com:443
222+
mirror.cveb.in:443
223+
mirror.cveb.in:80
224+
motd.ubuntu.com:443
225+
nvd.nist.gov:443
226+
osv-vulnerabilities.storage.googleapis.com:443
227+
packages.microsoft.com:443
228+
ppa.launchpadcontent.net:443
229+
pypi.org:443
230+
raw.githubusercontent.com:443
231+
release-monitoring.org:443
232+
rpmfind.net:443
233+
security-tracker.debian.org:443
234+
services.nvd.nist.gov:443
235+
storage.googleapis.com:443
236+
uploader.codecov.io:443
237+
www.cisa.gov:443
238+
www.sqlite.org:443
170239
171240
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
172241
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
@@ -277,6 +346,8 @@ jobs:
277346

278347
linux-mayfail:
279348
name: Tests that may fail due to network or HTML
349+
permissions:
350+
contents: read
280351
if: |
281352
! github.event.pull_request.user.login == 'github-actions[bot]' ||
282353
! (
@@ -294,7 +365,34 @@ jobs:
294365
- name: Harden Runner
295366
uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1
296367
with:
297-
egress-policy: audit
368+
egress-policy: block
369+
allowed-endpoints: >
370+
access.redhat.com:443
371+
api.github.com:443
372+
azure.archive.ubuntu.com:80
373+
csrc.nist.gov:443
374+
curl.se:443
375+
epss.cyentia.com:443
376+
esm.ubuntu.com:443
377+
files.pythonhosted.org:443
378+
github.com:443
379+
gitlab.com:443
380+
mirror.cveb.in:443
381+
mirror.cveb.in:80
382+
motd.ubuntu.com:443
383+
nvd.nist.gov:443
384+
osv-vulnerabilities.storage.googleapis.com:443
385+
packages.microsoft.com:443
386+
playwright.azureedge.net:443
387+
ppa.launchpadcontent.net:443
388+
pypi.org:443
389+
release-monitoring.org:443
390+
scap.nist.gov:443
391+
security-tracker.debian.org:443
392+
services.nvd.nist.gov:443
393+
storage.googleapis.com:443
394+
www.cisa.gov:443
395+
www.sqlite.org:443
298396
299397
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
300398
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
@@ -379,6 +477,8 @@ jobs:
379477
380478
windows_long_tests:
381479
name: Windows long tests
480+
permissions:
481+
contents: read
382482
if: |
383483
! github.event.pull_request.user.login == 'github-actions[bot]' ||
384484
! (

0 commit comments

Comments
 (0)