Skip to content

Commit 5303cc5

Browse files
authored
feat(security): Enable block harden runner (#47)
1 parent 9e5df42 commit 5303cc5

File tree

5 files changed

+50
-12
lines changed

5 files changed

+50
-12
lines changed

.github/workflows/conventional-commit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ jobs:
2424
pull-requests: read
2525

2626
steps:
27-
- name: Harden the runner (Audit all outbound calls)
27+
- name: Harden Runner
2828
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
2929
with:
30-
egress-policy: audit
30+
egress-policy: block
3131

3232
- name: Check PR title format
3333
uses: agenthunt/conventional-commit-checker-action@f1823f632e95a64547566dcd2c7da920e67117ad # v2.0.1

.github/workflows/find-secrets.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ concurrency:
1414
group: ${{ github.workflow }}-${{ github.ref }}
1515
cancel-in-progress: true
1616

17+
env:
18+
step-security-allowed-endpoints: >
19+
ghcr.io:443
20+
github.com:443
21+
pkg-containers.githubusercontent.com:443
22+
1723
jobs:
1824
scan-secrets:
1925
name: Scan for secrets
@@ -23,10 +29,11 @@ jobs:
2329
contents: read
2430

2531
steps:
26-
- name: Harden the runner (Audit all outbound calls)
32+
- name: Harden Runner
2733
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
2834
with:
29-
egress-policy: audit
35+
egress-policy: block
36+
allowed-endpoints: ${{ env.step-security-allowed-endpoints }}
3037

3138
- name: Checkout repository
3239
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

.github/workflows/pr-conflict-checker.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ on:
1212

1313
permissions: {}
1414

15+
env:
16+
step-security-allowed-endpoints: >
17+
api.github.com:443
18+
github.com:443
19+
1520
concurrency:
1621
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
1722
cancel-in-progress: true
@@ -27,10 +32,11 @@ jobs:
2732
issues: write
2833

2934
steps:
30-
- name: Harden the runner (Audit all outbound calls)
35+
- name: Harden Runner
3136
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
3237
with:
33-
egress-policy: audit
38+
egress-policy: block
39+
allowed-endpoints: ${{ env.step-security-allowed-endpoints }}
3440

3541
- name: Checkout PR head
3642
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

.github/workflows/pull-request.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@ concurrency:
1414
group: ${{ github.workflow }}-${{ github.ref }}
1515
cancel-in-progress: true
1616

17+
env:
18+
step-security-allowed-endpoints: >
19+
api.github.com:443
20+
auth.safetycli.com:443
21+
cli.codecov.io:443
22+
data.safetycli.com:443
23+
files.pythonhosted.org:443
24+
github.com:443
25+
ingest.codecov.io:443
26+
keybase.io:443
27+
o26192.ingest.us.sentry.io:443
28+
pypi.org:443
29+
pyup.io:443
30+
release-assets.githubusercontent.com:443
31+
1732
jobs:
1833
build:
1934
name: Lint and test (Python ${{ matrix.python-version }})
@@ -25,10 +40,11 @@ jobs:
2540
permissions:
2641
contents: read
2742
steps:
28-
- name: Harden the runner (Audit all outbound calls)
43+
- name: Harden Runner
2944
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
3045
with:
31-
egress-policy: audit
46+
egress-policy: block
47+
allowed-endpoints: ${{ env.step-security-allowed-endpoints }}
3248

3349
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3450
with:

.github/workflows/zizmor.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ on:
1414

1515
permissions: {}
1616

17+
env:
18+
step-security-allowed-endpoints: >
19+
api.github.com:443
20+
ghcr.io:443
21+
github.com:443
22+
pkg-containers.githubusercontent.com:443
23+
1724
jobs:
1825
zizmor-pr:
1926
name: Run zizmor (PR)
@@ -23,10 +30,11 @@ jobs:
2330
contents: read
2431
actions: read
2532
steps:
26-
- name: Harden the runner (Audit all outbound calls)
33+
- name: Harden Runner
2734
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
2835
with:
29-
egress-policy: audit
36+
egress-policy: block
37+
allowed-endpoints: ${{ env.step-security-allowed-endpoints }}
3038

3139
- name: Checkout repository
3240
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -48,10 +56,11 @@ jobs:
4856
contents: read
4957
actions: read
5058
steps:
51-
- name: Harden the runner (Audit all outbound calls)
59+
- name: Harden Runner
5260
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
5361
with:
54-
egress-policy: audit
62+
egress-policy: block
63+
allowed-endpoints: ${{ env.step-security-allowed-endpoints }}
5564

5665
- name: Checkout repository
5766
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

0 commit comments

Comments
 (0)