Skip to content

Commit fca9e3a

Browse files
step-security-botondrejmirtes
authored andcommitted
[StepSecurity] ci: Harden GitHub Actions
Signed-off-by: StepSecurity Bot <bot@stepsecurity.io>
1 parent bfdcb62 commit fca9e3a

File tree

7 files changed

+91
-26
lines changed

7 files changed

+91
-26
lines changed

.github/workflows/build.yml

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,16 @@ jobs:
2929
- "8.5"
3030

3131
steps:
32+
- name: Harden the runner (Audit all outbound calls)
33+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
34+
with:
35+
egress-policy: audit
36+
3237
- name: "Checkout"
33-
uses: actions/checkout@v6
38+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3439

3540
- name: "Install PHP"
36-
uses: "shivammathur/setup-php@v2"
41+
uses: "shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # v2
3742
with:
3843
coverage: "none"
3944
php-version: "${{ matrix.php-version }}"
@@ -53,18 +58,23 @@ jobs:
5358
runs-on: "ubuntu-latest"
5459

5560
steps:
61+
- name: Harden the runner (Audit all outbound calls)
62+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
63+
with:
64+
egress-policy: audit
65+
5666
- name: "Checkout"
57-
uses: actions/checkout@v6
67+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5868

5969
- name: "Checkout build-cs"
60-
uses: actions/checkout@v6
70+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
6171
with:
6272
repository: "phpstan/build-cs"
6373
path: "build-cs"
6474
ref: "2.x"
6575

6676
- name: "Install PHP"
67-
uses: "shivammathur/setup-php@v2"
77+
uses: "shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # v2
6878
with:
6979
coverage: "none"
7080
php-version: "8.2"
@@ -129,11 +139,16 @@ jobs:
129139
phpunit-version: "^12.0.9"
130140

131141
steps:
142+
- name: Harden the runner (Audit all outbound calls)
143+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
144+
with:
145+
egress-policy: audit
146+
132147
- name: "Checkout"
133-
uses: actions/checkout@v6
148+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
134149

135150
- name: "Install PHP"
136-
uses: "shivammathur/setup-php@v2"
151+
uses: "shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # v2
137152
with:
138153
coverage: "none"
139154
php-version: "${{ matrix.php-version }}"
@@ -196,11 +211,16 @@ jobs:
196211
phpunit-version: "^12.0.9"
197212

198213
steps:
214+
- name: Harden the runner (Audit all outbound calls)
215+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
216+
with:
217+
egress-policy: audit
218+
199219
- name: "Checkout"
200-
uses: actions/checkout@v6
220+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
201221

202222
- name: "Install PHP"
203-
uses: "shivammathur/setup-php@v2"
223+
uses: "shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # v2
204224
with:
205225
coverage: "none"
206226
php-version: "${{ matrix.php-version }}"
@@ -237,11 +257,16 @@ jobs:
237257
operating-system: [ubuntu-latest]
238258

239259
steps:
260+
- name: Harden the runner (Audit all outbound calls)
261+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
262+
with:
263+
egress-policy: audit
264+
240265
- name: "Checkout"
241-
uses: actions/checkout@v6
266+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
242267

243268
- name: "Checkout build-infection"
244-
uses: actions/checkout@v6
269+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
245270
with:
246271
repository: "phpstan/build-infection"
247272
path: "build-infection"
@@ -271,7 +296,7 @@ jobs:
271296
echo "name=$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')" >> $GITHUB_OUTPUT
272297
273298
- name: "Restore result cache"
274-
uses: actions/cache/restore@v5
299+
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
275300
with:
276301
path: ./tmp
277302
key: "result-cache-v1-${{ matrix.php-version }}-${{ github.run_id }}"
@@ -292,7 +317,7 @@ jobs:
292317
--logger-text=php://stdout
293318
294319
- name: "Save result cache"
295-
uses: actions/cache/save@v5
320+
uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
296321
if: ${{ !cancelled() }}
297322
with:
298323
path: ./tmp

.github/workflows/claude-react-on-comment.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ jobs:
2828
outputs:
2929
triggered: ${{ steps.check.outputs.triggered }}
3030
steps:
31+
- name: Harden the runner (Audit all outbound calls)
32+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
33+
with:
34+
egress-policy: audit
35+
3136
- name: "Check for trigger phrase"
3237
id: check
3338
env:
@@ -47,11 +52,16 @@ jobs:
4752
timeout-minutes: 60
4853

4954
steps:
55+
- name: Harden the runner (Audit all outbound calls)
56+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
57+
with:
58+
egress-policy: audit
59+
5060
- name: "Checkout"
51-
uses: actions/checkout@v4
61+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
5262

5363
- name: "React to feedback"
54-
uses: anthropics/claude-code-action@v1
64+
uses: anthropics/claude-code-action@35a9e0292d36f1186f5d842b14eb575074e8b450 # v1.0.57
5565
with:
5666
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
5767
trigger_phrase: "@phpstan-bot"

.github/workflows/create-tag.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,38 @@ jobs:
2020
name: "Create tag"
2121
runs-on: "ubuntu-latest"
2222
steps:
23+
- name: Harden the runner (Audit all outbound calls)
24+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
25+
with:
26+
egress-policy: audit
27+
2328
- name: "Checkout"
24-
uses: actions/checkout@v6
29+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2530
with:
2631
fetch-depth: 0
2732
token: ${{ secrets.PHPSTAN_BOT_TOKEN }}
2833

2934
- name: 'Get Previous tag'
3035
id: previoustag
31-
uses: "WyriHaximus/github-action-get-previous-tag@v2"
36+
uses: "WyriHaximus/github-action-get-previous-tag@61819f33034117e6c686e6a31dba995a85afc9de" # v2.0.0
3237
env:
3338
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
3439

3540
- name: 'Get next versions'
3641
id: semvers
37-
uses: "WyriHaximus/github-action-next-semvers@v1"
42+
uses: "WyriHaximus/github-action-next-semvers@d079934efaf011a4cf8912d4637097fe35d32b93" # v1
3843
with:
3944
version: ${{ steps.previoustag.outputs.tag }}
4045

4146
- name: "Create new minor tag"
42-
uses: rickstaa/action-create-tag@v1
47+
uses: rickstaa/action-create-tag@a1c7777fcb2fee4f19b0f283ba888afa11678b72 # v1.7.2
4348
if: inputs.version == 'minor'
4449
with:
4550
tag: ${{ steps.semvers.outputs.minor }}
4651
message: ${{ steps.semvers.outputs.minor }}
4752

4853
- name: "Create new patch tag"
49-
uses: rickstaa/action-create-tag@v1
54+
uses: rickstaa/action-create-tag@a1c7777fcb2fee4f19b0f283ba888afa11678b72 # v1.7.2
5055
if: inputs.version == 'patch'
5156
with:
5257
tag: ${{ steps.semvers.outputs.patch }}

.github/workflows/lock-closed-issues.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,21 @@ on:
44
schedule:
55
- cron: '7 0 * * *'
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
lock:
12+
permissions:
13+
issues: write # for dessant/lock-threads to lock issues
914
runs-on: ubuntu-latest
1015
steps:
11-
- uses: dessant/lock-threads@v6
16+
- name: Harden the runner (Audit all outbound calls)
17+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
18+
with:
19+
egress-policy: audit
20+
21+
- uses: dessant/lock-threads@7266a7ce5c1df01b1c6db85bf8cd86c737dadbe7 # v6.0.0
1222
with:
1323
github-token: ${{ github.token }}
1424
issue-inactive-days: '31'

.github/workflows/release-toot.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ jobs:
1010
toot:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: cbrgm/mastodon-github-action@v2
13+
- name: Harden the runner (Audit all outbound calls)
14+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
15+
with:
16+
egress-policy: audit
17+
18+
- uses: cbrgm/mastodon-github-action@845250b56b82d94e26bf23984d5e0cf5ced6d18f # v2.1.25
1419
if: ${{ !github.event.repository.private }}
1520
with:
1621
# GitHub event payload

.github/workflows/release-tweet.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ jobs:
1010
tweet:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: Eomm/why-don-t-you-tweet@v2
13+
- name: Harden the runner (Audit all outbound calls)
14+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
15+
with:
16+
egress-policy: audit
17+
18+
- uses: Eomm/why-don-t-you-tweet@d9ec12835f4d494dda920f95f885df3dba380493 # v2.0.0
1419
if: ${{ !github.event.repository.private }}
1520
with:
1621
# GitHub event payload

.github/workflows/release.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,23 @@ jobs:
1313
runs-on: "ubuntu-latest"
1414

1515
steps:
16+
- name: Harden the runner (Audit all outbound calls)
17+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
18+
with:
19+
egress-policy: audit
20+
1621
- name: "Checkout"
17-
uses: actions/checkout@v6
22+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1823

1924
- name: Generate changelog
2025
id: changelog
21-
uses: metcalfc/changelog-generator@v4.6.2
26+
uses: metcalfc/changelog-generator@3f82cef08fe5dcf57c591fe165e70e1d5032e15a # v4.6.2
2227
with:
2328
myToken: ${{ secrets.PHPSTAN_BOT_TOKEN }}
2429

2530
- name: "Create release"
2631
id: create-release
27-
uses: actions/create-release@v1
32+
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1.1.4
2833
env:
2934
GITHUB_TOKEN: ${{ secrets.PHPSTAN_BOT_TOKEN }}
3035
with:

0 commit comments

Comments
 (0)