Skip to content

Commit 61a81ea

Browse files
authored
Harden GitHub workflows (#493)
1 parent 9a350ad commit 61a81ea

7 files changed

Lines changed: 44 additions & 5 deletions

File tree

‎.github/workflows/bc.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ on:
1313

1414
name: backwards compatibility
1515

16+
permissions:
17+
contents: read
18+
1619
concurrency:
1720
group: ${{ github.workflow }}-${{ github.ref }}
1821
cancel-in-progress: true

‎.github/workflows/composer-require-checker.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ on:
1616

1717
name: Composer require checker
1818

19+
permissions:
20+
contents: read
21+
1922
concurrency:
2023
group: ${{ github.workflow }}-${{ github.ref }}
2124
cancel-in-progress: true

‎.github/workflows/mutation.yml‎

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

1515
name: mutation test
1616

17+
permissions:
18+
contents: read
19+
1720
concurrency:
1821
group: ${{ github.workflow }}-${{ github.ref }}
1922
cancel-in-progress: true
@@ -38,7 +41,7 @@ jobs:
3841

3942
services:
4043
postgres:
41-
image: postgres:17
44+
image: postgres:17 # zizmor: ignore[unpinned-images]
4245
env:
4346
POSTGRES_USER: root
4447
POSTGRES_PASSWORD: root
@@ -49,18 +52,20 @@ jobs:
4952

5053
steps:
5154
- name: Checkout.
52-
uses: actions/checkout@v7
55+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
56+
with:
57+
persist-credentials: false
5358

5459
- name: Install PHP with extensions.
55-
uses: shivammathur/setup-php@v2
60+
uses: shivammathur/setup-php@b604ade2a87db23f8871b7182e69ec5e75effb45
5661
with:
5762
php-version: ${{ matrix.php }}
5863
extensions: ${{ env.EXTENSIONS }}
5964
ini-values: memory_limit=-1
6065
coverage: pcov
6166

6267
- name: Install Composer dependencies
63-
uses: ramsey/composer-install@v4
68+
uses: ramsey/composer-install@a8d0d959dab41457692a5e2041bd9b757a119e3f
6469

6570
- name: Install db.
6671
uses: yiisoft/actions/install-packages@master

‎.github/workflows/rector-cs.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ on:
1111
- '.php-cs-fixer.dist.php'
1212

1313
permissions:
14-
contents: write
14+
contents: read
1515

1616
concurrency:
1717
group: ${{ github.workflow }}-${{ github.ref }}
1818
cancel-in-progress: true
1919

2020
jobs:
2121
rector:
22+
permissions:
23+
contents: write # Required to commit automated Rector and CS fixes.
2224
uses: yiisoft/actions/.github/workflows/rector-cs.yml@master
2325
with:
2426
php: '8.1'

‎.github/workflows/static.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ on:
1616

1717
name: Static analysis
1818

19+
permissions:
20+
contents: read
21+
1922
concurrency:
2023
group: ${{ github.workflow }}-${{ github.ref }}
2124
cancel-in-progress: true

‎.github/workflows/zizmor.yml‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: GitHub Actions Security Analysis with zizmor 🌈
2+
3+
on:
4+
push:
5+
paths:
6+
- '.github/**.yml'
7+
- '.github/**.yaml'
8+
pull_request:
9+
paths:
10+
- '.github/**.yml'
11+
- '.github/**.yaml'
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
zizmor:
18+
uses: yiisoft/actions/.github/workflows/zizmor.yml@master

‎.github/zizmor.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
rules:
2+
unpinned-uses:
3+
config:
4+
policies:
5+
"yiisoft/*": any

0 commit comments

Comments
 (0)