Skip to content

Commit fa93f1c

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

12 files changed

+145
-38
lines changed

.github/workflows/apiref.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,18 @@ jobs:
2626
- "2.3.x"
2727

2828
steps:
29+
- name: Harden the runner (Audit all outbound calls)
30+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
31+
with:
32+
egress-policy: audit
33+
2934
- name: "Checkout"
30-
uses: actions/checkout@v4
35+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
3136
with:
3237
ref: ${{ matrix.branch }}
3338

3439
- name: "Install PHP"
35-
uses: "shivammathur/setup-php@v2"
40+
uses: "shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # v2
3641
with:
3742
coverage: "none"
3843
php-version: "8.1"
@@ -52,7 +57,7 @@ jobs:
5257
- name: "Copy favicon"
5358
run: "cp apigen/favicon.png docs/favicon.png"
5459

55-
- uses: actions/upload-artifact@v4
60+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
5661
with:
5762
name: docs-${{ matrix.branch }}
5863
path: docs/*
@@ -64,14 +69,19 @@ jobs:
6469
runs-on: "ubuntu-latest"
6570

6671
steps:
67-
- uses: actions/download-artifact@v4
72+
- name: Harden the runner (Audit all outbound calls)
73+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
74+
with:
75+
egress-policy: audit
76+
77+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
6878
with:
6979
pattern: docs-*
7080
path: docs
7181
merge-multiple: true
7282

7383
- name: Upload artifact
74-
uses: actions/upload-pages-artifact@v3
84+
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
7585
with:
7686
path: 'docs'
7787

@@ -90,6 +100,11 @@ jobs:
90100

91101
runs-on: ubuntu-latest
92102
steps:
103+
- name: Harden the runner (Audit all outbound calls)
104+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
105+
with:
106+
egress-policy: audit
107+
93108
- name: Deploy to GitHub Pages
94109
id: deployment
95-
uses: actions/deploy-pages@v4
110+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5

.github/workflows/backward-compatibility.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
branches:
99
- "2.3.x"
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
backward-compatibility:
1316
name: "Backward Compatibility"
@@ -16,13 +19,18 @@ jobs:
1619
timeout-minutes: 30
1720

1821
steps:
22+
- name: Harden the runner (Audit all outbound calls)
23+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
24+
with:
25+
egress-policy: audit
26+
1927
- name: "Checkout"
20-
uses: actions/checkout@v4
28+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
2129
with:
2230
fetch-depth: 0
2331

2432
- name: "Install PHP"
25-
uses: "shivammathur/setup-php@v2"
33+
uses: "shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # v2
2634
with:
2735
coverage: "none"
2836
php-version: "8.3"

.github/workflows/build.yml

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
branches:
99
- "2.3.x"
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
lint:
1316
name: "Lint"
@@ -25,11 +28,16 @@ jobs:
2528
- "8.5"
2629

2730
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+
2836
- name: "Checkout"
29-
uses: actions/checkout@v4
37+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
3038

3139
- name: "Install PHP"
32-
uses: "shivammathur/setup-php@v2"
40+
uses: "shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # v2
3341
with:
3442
coverage: "none"
3543
php-version: "${{ matrix.php-version }}"
@@ -49,18 +57,23 @@ jobs:
4957
runs-on: "ubuntu-latest"
5058

5159
steps:
60+
- name: Harden the runner (Audit all outbound calls)
61+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
62+
with:
63+
egress-policy: audit
64+
5265
- name: "Checkout"
53-
uses: actions/checkout@v4
66+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
5467

5568
- name: "Checkout build-cs"
56-
uses: actions/checkout@v4
69+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
5770
with:
5871
repository: "phpstan/build-cs"
5972
path: "build-cs"
6073
ref: "2.x"
6174

6275
- name: "Install PHP"
63-
uses: "shivammathur/setup-php@v2"
76+
uses: "shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # v2
6477
with:
6578
coverage: "none"
6679
php-version: "8.2"
@@ -102,11 +115,16 @@ jobs:
102115
- "highest"
103116

104117
steps:
118+
- name: Harden the runner (Audit all outbound calls)
119+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
120+
with:
121+
egress-policy: audit
122+
105123
- name: "Checkout"
106-
uses: actions/checkout@v4
124+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
107125

108126
- name: "Install PHP"
109-
uses: "shivammathur/setup-php@v2"
127+
uses: "shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # v2
110128
with:
111129
coverage: "none"
112130
php-version: "${{ matrix.php-version }}"
@@ -139,11 +157,16 @@ jobs:
139157
- "8.5"
140158

141159
steps:
160+
- name: Harden the runner (Audit all outbound calls)
161+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
162+
with:
163+
egress-policy: audit
164+
142165
- name: "Checkout"
143-
uses: actions/checkout@v4
166+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
144167

145168
- name: "Install PHP"
146-
uses: "shivammathur/setup-php@v2"
169+
uses: "shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # v2
147170
with:
148171
coverage: "none"
149172
php-version: "${{ matrix.php-version }}"

.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@v4
29+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
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@v1"
36+
uses: "WyriHaximus/github-action-get-previous-tag@04e8485ecb6487243907e330d522ff60f02283ce" # v1.4.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: '8 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@v5
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@1bf7ec25051fe7c00bdd17e6a7cf3d7bfb7dc771 # v5.0.1
1222
with:
1323
github-token: ${{ github.token }}
1424
issue-inactive-days: '31'

.github/workflows/merge-maintained-branch.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,15 @@ jobs:
1212
name: Merge branch
1313
runs-on: ubuntu-latest
1414
steps:
15+
- name: Harden the runner (Audit all outbound calls)
16+
uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
17+
with:
18+
egress-policy: audit
19+
1520
- name: "Checkout"
16-
uses: actions/checkout@v4
21+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
1722
- name: "Merge branch"
18-
uses: everlytic/branch-merge@1.1.5
23+
uses: everlytic/branch-merge@c4a244dc23143f824ae6c022a10732566cb8e973 # 1.1.5
1924
with:
2025
github_token: "${{ secrets.PHPSTAN_BOT_TOKEN }}"
2126
source_ref: ${{ github.ref }}

.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@v1
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@54e11450e21479faa5db172b9f2c10a29aedfc62 # v1.1.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@v4
22+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
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)