Skip to content

Commit 157b9f3

Browse files
authored
security(ci): harden workflows and add zizmor audit (#571)
1 parent a0f56e6 commit 157b9f3

5 files changed

Lines changed: 47 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3434
with:
3535
fetch-depth: 0
36+
persist-credentials: false
3637

3738
- name: Install pnpm
3839
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
@@ -71,6 +72,7 @@ jobs:
7172
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
7273
with:
7374
fetch-depth: 0
75+
persist-credentials: false
7476

7577
- name: Install pnpm
7678
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
@@ -114,6 +116,7 @@ jobs:
114116
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
115117
with:
116118
fetch-depth: 0
119+
persist-credentials: false
117120

118121
- name: Install pnpm
119122
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0

.github/workflows/nightly-release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
branches:
1010
- main
1111

12+
permissions:
13+
contents: read
14+
1215
jobs:
1316
release:
1417
runs-on: ubuntu-latest
@@ -18,6 +21,7 @@ jobs:
1821
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1922
with:
2023
fetch-depth: 0
24+
persist-credentials: false
2125

2226
- name: Install pnpm
2327
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0

.github/workflows/release.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout
18+
# zizmor: ignore[artipacked] needs persisted credentials so that
19+
# stefanzweifel/git-auto-commit-action can push the changelog commit.
1820
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1921
with:
2022
ref: ${{ github.head_ref }}
@@ -39,14 +41,16 @@ jobs:
3941
separator: '/'
4042

4143
- name: Create Github Release
42-
run: gh release create ${{ steps.split.outputs._2 }} --generate-notes
44+
run: gh release create "$TAG" --generate-notes
4345
env:
4446
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
TAG: ${{ steps.split.outputs._2 }}
4548

4649
- name: Generate changelog
47-
run: pnpx gh-changelogen --repo=intlify/bundle-tools --tag=${{ steps.split.outputs._2 }}
50+
run: pnpx gh-changelogen --repo=intlify/bundle-tools --tag="$TAG"
4851
env:
4952
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
TAG: ${{ steps.split.outputs._2 }}
5054

5155
- name: Commit changelog
5256
uses: stefanzweifel/git-auto-commit-action@8756aa072ef5b4a080af5dc8fef36c5d586e521d # v5.0.0

.github/workflows/reproduire.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
types: [labeled]
55

66
permissions:
7+
contents: read
78
issues: write
89

910
jobs:
@@ -14,6 +15,7 @@ jobs:
1415
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1516
with:
1617
fetch-depth: 0
18+
persist-credentials: false
1719
- uses: Hebilicious/reproduire@4b686ae9cbb72dad60f001d278b6e3b2ce40a9ac # v0.0.9-mp
1820
with:
1921
label: 'Status: Need More Info' # Optional, will default to this value.

.github/workflows/zizmor.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: GitHub Actions Security Analysis with zizmor
2+
3+
on:
4+
push:
5+
branches: [v11, main]
6+
paths:
7+
- .github/workflows/**
8+
pull_request:
9+
branches: ['**']
10+
paths:
11+
- .github/workflows/**
12+
13+
permissions: {}
14+
15+
jobs:
16+
zizmor:
17+
name: Run zizmor
18+
runs-on: ubuntu-latest
19+
permissions:
20+
security-events: write
21+
contents: read
22+
actions: read
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
26+
with:
27+
persist-credentials: false
28+
29+
- name: Run zizmor
30+
uses: zizmorcore/zizmor-action@5f14fd08f7cf1cb1609c1e344975f152c7ee938d # v0.5.6
31+
with:
32+
inputs: .github/workflows/

0 commit comments

Comments
 (0)