Skip to content

Commit b7925bf

Browse files
committed
Block outbound calls from ci runners to unallowed endpoints
1 parent a03adea commit b7925bf

10 files changed

Lines changed: 242 additions & 27 deletions

File tree

.github/workflows/build.yml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,26 @@ jobs:
2222
security-events: write
2323

2424
steps:
25-
- name: Harden the runner (Audit all outbound calls)
25+
- name: "Harden the runner (Block egress traffic: Only allow calls to allowed endpoints)"
2626
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
2727
with:
28-
egress-policy: audit
28+
egress-policy: block
29+
allowed-endpoints: >+
30+
github.com:443
31+
api.github.com:443
32+
release-assets.githubusercontent.com:443
33+
uploads.github.com:443
34+
pypi.org:443
35+
files.pythonhosted.org:443
36+
packages.microsoft.com:443
37+
azure.archive.ubuntu.com:80
38+
esm.ubuntu.com:443
39+
index.rubygems.org:443
40+
rubygems.org:443
41+
community.chocolatey.org:443
42+
community.chocolatey.org:80
43+
packages.chocolatey.org:443
44+
api.nuget.org:443
2945
3046
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3147
with:
@@ -207,10 +223,17 @@ jobs:
207223
runs-on: ubuntu-latest
208224

209225
steps:
210-
- name: Harden the runner (Audit all outbound calls)
226+
- name: "Harden the runner (Block egress traffic: Only allow calls to allowed endpoints)"
211227
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
212228
with:
213-
egress-policy: audit
229+
egress-policy: block
230+
allowed-endpoints: >+
231+
github.com:443
232+
api.github.com:443
233+
release-assets.githubusercontent.com:443
234+
pypi.org:443
235+
files.pythonhosted.org:443
236+
214237
215238
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
216239
with:

.github/workflows/codeql-analysis.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,14 @@ jobs:
3434
runs-on: ubuntu-latest
3535

3636
steps:
37-
- name: Harden the runner (Audit all outbound calls)
37+
- name: "Harden the runner (Block egress traffic: Only allow calls to allowed endpoints)"
3838
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
3939
with:
40-
egress-policy: audit
40+
egress-policy: block
41+
allowed-endpoints: >+
42+
github.com:443
43+
api.github.com:443
44+
release-assets.githubusercontent.com:443
4145
4246
- name: Checkout repository
4347
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

.github/workflows/dependency-review.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ jobs:
1616
dependency-review:
1717
runs-on: ubuntu-latest
1818
steps:
19-
- name: Harden the runner (Audit all outbound calls)
19+
- name: "Harden the runner (Block egress traffic: Only allow calls to allowed endpoints)"
2020
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
2121
with:
22-
egress-policy: audit
22+
egress-policy: block
23+
allowed-endpoints: >+
24+
api.github.com:443
25+
github.com:443
2326
2427
- name: 'Checkout Repository'
2528
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

.github/workflows/devcontainer.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,37 @@ jobs:
1515
runs-on: ubuntu-latest
1616

1717
steps:
18-
- name: Harden the runner (Audit all outbound calls)
18+
- name: "Harden the runner (Block egress traffic: Only allow calls to allowed endpoints)"
1919
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
2020
with:
21-
egress-policy: audit
21+
egress-policy: block
22+
allowed-endpoints: >+
23+
_http._tcp.deb.debian.org:443
24+
*.data.mcr.microsoft.com:443
25+
api.github.com:443
26+
auth.docker.io:443
27+
containers.dev:443
28+
deb.debian.org:443
29+
deb.debian.org:80
30+
debian.map.fastlydns.net:443
31+
debian.map.fastlydns.net:80
32+
dl.google.com:443
33+
files.pythonhosted.org:443
34+
github.com:443
35+
go.dev:443
36+
index.rubygems.org:443
37+
mcr.microsoft.com:443
38+
nodejs.org:443
39+
www.plantuml.com:443
40+
plantuml.com:443
41+
plantuml.com:80
42+
production.cloudflare.docker.com:443
43+
proxy.golang.org:443
44+
pypi.org:443
45+
registry-1.docker.io:443
46+
registry.npmjs.org:443
47+
rubygems.org:443
48+
storage.googleapis.com:443
2249
2350
- name: Checkout repository
2451
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

.github/workflows/docs.yml

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,17 @@ jobs:
1616
name: Documentation
1717
runs-on: ubuntu-latest
1818
steps:
19-
- name: Harden the runner (Audit all outbound calls)
19+
- name: "Harden the runner (Block egress traffic: Only allow calls to allowed endpoints)"
2020
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
2121
with:
22-
egress-policy: audit
22+
egress-policy: block
23+
allowed-endpoints: >+
24+
github.com:443
25+
pypi.org:443
26+
files.pythonhosted.org:443
27+
plantuml.com:80
28+
plantuml.com:443
29+
www.plantuml.com:80
2330
2431
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2532
with:
@@ -41,10 +48,18 @@ jobs:
4148
name: Landing page
4249
runs-on: ubuntu-latest
4350
steps:
44-
- name: Harden the runner (Audit all outbound calls)
51+
- name: "Harden the runner (Block egress traffic: Only allow calls to allowed endpoints)"
4552
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
4653
with:
47-
egress-policy: audit
54+
egress-policy: block
55+
allowed-endpoints: >+
56+
github.com:443
57+
github.com:22
58+
pypi.org:443
59+
files.pythonhosted.org:443
60+
plantuml.com:80
61+
plantuml.com:443
62+
www.plantuml.com:80
4863
4964
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5065

@@ -75,10 +90,26 @@ jobs:
7590
permissions:
7691
contents: write
7792
steps:
78-
- name: Harden the runner (Audit all outbound calls)
93+
- name: "Harden the runner (Block egress traffic: Only allow calls to allowed endpoints)"
7994
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
8095
with:
81-
egress-policy: audit
96+
egress-policy: block
97+
allowed-endpoints: >+
98+
_http._tcp.azure.archive.ubuntu.com:443
99+
_https._tcp.archive.ubuntu.com:443
100+
_https._tcp.security.ubuntu.com:443
101+
archive.ubuntu.com:443
102+
azure.archive.ubuntu.com:443
103+
azure.archive.ubuntu.com:80
104+
files.pythonhosted.org:443
105+
github.com:443
106+
api.github.com:443
107+
uploads.github.com:443
108+
plantuml.com:443
109+
plantuml.com:80
110+
pypi.org:443
111+
security.ubuntu.com:443
112+
www.plantuml.com:80
82113
83114
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
84115
with:

.github/workflows/python-publish.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,16 @@ jobs:
2020
runs-on: ubuntu-latest
2121

2222
steps:
23-
- name: Harden the runner (Audit all outbound calls)
23+
- name: "Harden the runner (Block egress traffic: Only allow calls to allowed endpoints)"
2424
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
2525
with:
26-
egress-policy: audit
26+
egress-policy: block
27+
allowed-endpoints: >+
28+
github.com:443
29+
api.github.com:443
30+
release-assets.githubusercontent.com:443
31+
pypi.org:443
32+
files.pythonhosted.org:443
2733
2834
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2935
with:

.github/workflows/release.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ jobs:
2323
steps:
2424
- uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
2525
with:
26-
egress-policy: audit
26+
egress-policy: block
27+
allowed-endpoints: >+
28+
github.com:443
29+
api.github.com:443
30+
release-assets.githubusercontent.com:443
31+
uploads.github.com:443
2732
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2833
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2934
with:

.github/workflows/run.yml

Lines changed: 78 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,19 @@ jobs:
1515
security-events: write
1616

1717
steps:
18-
- name: Harden the runner (Audit all outbound calls)
18+
- name: "Harden the runner (Block egress traffic: Only allow calls to allowed endpoints)"
1919
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
2020
with:
21-
egress-policy: audit
21+
egress-policy: block
22+
allowed-endpoints: >+
23+
github.com:443
24+
api.github.com:443
25+
release-assets.githubusercontent.com:443
26+
pypi.org:443
27+
files.pythonhosted.org:443
28+
community.chocolatey.org:443
29+
community.chocolatey.org:80
30+
packages.chocolatey.org:443
2231
2332
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2433

@@ -67,16 +76,81 @@ jobs:
6776
matrix:
6877
platform: [ubuntu-latest, macos-latest, windows-latest]
6978
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
79+
include:
80+
- platform: ubuntu-latest
81+
allowed-endpoints: >+
82+
_http._tcp.azure.archive.ubuntu.com:443
83+
_https._tcp.archive.ubuntu.com:443
84+
_https._tcp.dl.google.com:443
85+
_https._tcp.esm.ubuntu.com:443
86+
_https._tcp.motd.ubuntu.com:443
87+
_https._tcp.security.ubuntu.com:443
88+
0.pool.ntp.org:443
89+
api.github.com:443
90+
archive.ubuntu.com:443
91+
azure.archive.ubuntu.com:443
92+
azure.archive.ubuntu.com:80
93+
cfhcable.dl.sourceforge.net:443
94+
cytranet-dal.dl.sourceforge.net:443
95+
dl.google.com:443
96+
downloads.sourceforge.net:443
97+
esm.ubuntu.com:443
98+
files.pythonhosted.org:443
99+
gigenet.dl.sourceforge.net:443
100+
github.com:443
101+
motd.ubuntu.com:443
102+
netactuate.dl.sourceforge.net:443
103+
pilotfiber.dl.sourceforge.net:443
104+
psychz.dl.sourceforge.net:443
105+
pypi.org:443
106+
release-assets.githubusercontent.com:443
107+
security.ubuntu.com:443
108+
sourceforge.net:443
109+
- platform: macos-latest
110+
allowed-endpoints: >+
111+
api.apple-cloudkit.com:443
112+
api.github.com:443
113+
files.pythonhosted.org:443
114+
formulae.brew.sh:443
115+
gdmf.apple.com:443
116+
ghcr.io:443
117+
github.com:443
118+
init.itunes.apple.com:443
119+
mask.icloud.com:443
120+
mesu.apple.com:443
121+
mirrors.ctan.org:443
122+
ocsp.sectigo.com:80
123+
ocsp2.apple.com:443
124+
pkg-containers.githubusercontent.com:443
125+
pypi.org:443
126+
release-assets.githubusercontent.com:443
127+
- platform: windows-latest
128+
allowed-endpoints: >+
129+
_https._tcp.packages.microsoft.com:443
130+
api.github.com:443
131+
community.chocolatey.org:443
132+
community.chocolatey.org:80
133+
dc.services.visualstudio.com:443
134+
fe2cr.update.microsoft.com:443
135+
files.pythonhosted.org:443
136+
github.com:443
137+
mobile.events.data.microsoft.com:443
138+
packages.chocolatey.org:443
139+
packages.microsoft.com:443
140+
pypi.org:443
141+
release-assets.githubusercontent.com:443
142+
ziglang.org:443
70143
runs-on: ${{ matrix.platform }}
71144
permissions:
72145
contents: read
73146
security-events: write
74147

75148
steps:
76-
- name: Harden the runner (Audit all outbound calls)
149+
- name: "Harden the runner (Block egress traffic: Only allow calls to allowed endpoints)"
77150
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
78151
with:
79-
egress-policy: audit
152+
egress-policy: block
153+
allowed-endpoints: ${{ matrix.allowed-endpoints }}
80154

81155
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
82156

.github/workflows/scorecard.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,21 @@ jobs:
2626
id-token: write
2727

2828
steps:
29-
- name: Harden the runner (Audit all outbound calls)
29+
- name: "Harden the runner (Block egress traffic: Only allow calls to allowed endpoints)"
3030
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
3131
with:
32-
egress-policy: audit
32+
egress-policy: block
33+
allowed-endpoints: >+
34+
github.com:443
35+
api.github.com:443
36+
raw.githubusercontent.com:443
37+
codeload.github.com:443
38+
uploads.github.com:443
39+
api.osv.dev:443
40+
www.bestpractices.dev:443
41+
api.securityscorecards.dev:443
42+
rekor.sigstore.dev:443
43+
fulcio.sigstore.dev:443
3344
3445
- name: "Checkout code"
3546
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

.github/workflows/test.yml

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,41 @@ jobs:
1010
test:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: Harden the runner (Audit all outbound calls)
13+
- name: "Harden the runner (Block egress traffic: Only allow calls to allowed endpoints)"
1414
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
1515
with:
16-
egress-policy: audit
16+
egress-policy: block
17+
# dfetch.invalid and giiiiiidhub.com are intentionally invalid test
18+
# domains used to verify network blocking/allowlist behaviour in the
19+
# feature tests; they are never reachable from the runner.
20+
allowed-endpoints: >+
21+
_http._tcp.azure.archive.ubuntu.com:443
22+
_https._tcp.archive.ubuntu.com:443
23+
_https._tcp.dl.google.com:443
24+
_https._tcp.esm.ubuntu.com:443
25+
_https._tcp.motd.ubuntu.com:443
26+
_https._tcp.packages.microsoft.com:443
27+
_https._tcp.security.ubuntu.com:443
28+
api.codacy.com:443
29+
archive.ubuntu.com:443
30+
artifacts.codacy.com:443
31+
azure.archive.ubuntu.com:443
32+
azure.archive.ubuntu.com:80
33+
coverage.codacy.com:443
34+
dfetch.invalid:443
35+
dl.google.com:443
36+
esm.ubuntu.com:443
37+
files.pythonhosted.org:443
38+
giiiiiidhub.com:443
39+
github.com:22
40+
github.com:443
41+
motd.ubuntu.com:443
42+
packages.microsoft.com:443
43+
pypi.org:443
44+
release-assets.githubusercontent.com:443
45+
security.ubuntu.com:443
46+
svn.code.sf.net:3690
47+
svn.code.sf.net:443
1748
1849
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1950

0 commit comments

Comments
 (0)