Skip to content

Commit fed10a8

Browse files
authored
security: harden GitHub Actions workflows (#201)
1 parent ab11cb6 commit fed10a8

4 files changed

Lines changed: 21 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ on:
99
jobs:
1010
lint:
1111
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
1214
steps:
1315
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
16+
with:
17+
persist-credentials: false
1418
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
1519
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
1620
with:
@@ -28,8 +32,12 @@ jobs:
2832
branch: ${{ github.head_ref }}
2933
test:
3034
runs-on: ubuntu-latest
35+
permissions:
36+
contents: read
3137
steps:
3238
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
39+
with:
40+
persist-credentials: false
3341
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
3442
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
3543
with:

.github/workflows/codeql.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323
steps:
2424
- name: Checkout repository
2525
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
26+
with:
27+
persist-credentials: false
2628

2729
- name: Initialize CodeQL
2830
uses: github/codeql-action/init@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4.35.4

.github/workflows/licensing.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ on:
1313
jobs:
1414
licensing:
1515
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
1618
steps:
1719
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1820
with:
1921
fetch-depth: 0
22+
persist-credentials: false
2023
- run: sudo gem install license_finder -v 7.1
2124
- run: npm install
2225
- run: license_finder

.github/workflows/publish.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,18 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
17-
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
17+
with:
18+
persist-credentials: false
19+
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 # zizmor: ignore[cache-poisoning]
1820
with:
1921
node-version: '24'
2022
registry-url: 'https://registry.npmjs.org'
23+
cache: ''
2124
- run: npm ci
2225
- run: npm run build
2326
- run: npm test
2427
- run: npm publish --provenance --access public
25-
- uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0
26-
with:
27-
generate_release_notes: true
28+
- run: gh release create "$TAG" --generate-notes
29+
env:
30+
GH_TOKEN: ${{ github.token }}
31+
TAG: ${{ github.ref_name }}

0 commit comments

Comments
 (0)