Skip to content

Commit 0338f37

Browse files
authored
Add zizmor workflow and harden github actions (#411)
* Add zizmor workflow * Add cooldown for dependabot * Increase to weekly updates for dependabot * Security hardening of ci.yml
1 parent bd6cbb1 commit 0338f37

3 files changed

Lines changed: 67 additions & 10 deletions

File tree

.github/dependabot.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@ updates:
77
package-ecosystem: "github-actions"
88
directory: "/"
99
schedule:
10-
interval: "monthly"
10+
interval: "weekly"
11+
cooldown:
12+
default-days: 7
13+
1114
-
1215
package-ecosystem: "composer"
1316
directory: "/"
1417
schedule:
15-
interval: "monthly"
18+
interval: "weekly"
19+
cooldown:
20+
default-days: 7

.github/workflows/ci.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,54 +10,71 @@ on:
1010
schedule:
1111
- cron: '55 17 * * *'
1212

13+
permissions: {}
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}-main
17+
cancel-in-progress: true
18+
1319
jobs:
1420
quality:
15-
uses: prinsfrank/CI-PHP/.github/workflows/quality.yml@main
21+
permissions:
22+
contents: read
23+
uses: prinsfrank/CI-PHP/.github/workflows/quality.yml@7f532694f9ad3b0da45333d0c140b340488ac9b1 # v1.2.0
1624
with:
1725
PHP_VERSION: '8.3'
1826
PHP_VERSIONS: '["8.2", "8.3", "8.4", "8.5"]'
19-
secrets: inherit
27+
secrets:
28+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2029

2130
feature:
2231
name: PHP Tests - Feature
2332
runs-on: ubuntu-latest
33+
permissions:
34+
contents: read
2435
strategy:
2536
matrix:
2637
php-version: ["8.2", "8.3", "8.4", "8.5"]
2738
steps:
2839
- name: Checkout code
29-
uses: actions/checkout@v6
40+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
41+
with:
42+
persist-credentials: false
3043

3144
- name: Setup PHP
32-
uses: shivammathur/setup-php@v2
45+
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
3346
with:
3447
php-version: ${{ matrix.php-version }}
3548
coverage: none
3649

3750
- name: Install dependencies
38-
uses: ramsey/composer-install@v4
51+
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
3952

4053
- name: Run Feature tests
4154
run: composer run feature
4255

4356
samples:
4457
name: PHP Tests - Samples
4558
runs-on: ubuntu-latest
59+
permissions:
60+
contents: read
4661
strategy:
4762
matrix:
4863
php-version: ["8.2", "8.3", "8.4", "8.5"]
4964
steps:
5065
- name: Checkout code
51-
uses: actions/checkout@v6
66+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
67+
with:
68+
persist-credentials: false
5269

5370
- name: Setup PHP
54-
uses: shivammathur/setup-php@v2
71+
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
5572
with:
5673
php-version: ${{ matrix.php-version }}
5774
coverage: none
5875

5976
- name: Install dependencies
60-
uses: ramsey/composer-install@v4
77+
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
6178

6279
- name: Run Samples tests
6380
run: vendor/bin/phpunit tests/Samples/

.github/workflows/zizmor.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: GitHub Actions Security Analysis with zizmor 🌈
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- '.github/**.yml'
9+
pull_request:
10+
paths:
11+
- '.github/**.yml'
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
zizmor:
22+
name: Run zizmor 🌈
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
27+
with:
28+
persist-credentials: false
29+
30+
- name: Run zizmor 🌈
31+
uses: zizmorcore/zizmor-action@5f14fd08f7cf1cb1609c1e344975f152c7ee938d # v0.5.6
32+
with:
33+
advanced-security: false
34+
annotations: true
35+
persona: 'pedantic'

0 commit comments

Comments
 (0)