Skip to content

Commit 655c3e0

Browse files
authored
ci: add missing permissions blocks to workflow files (#211)
Add explicit permissions blocks following the principle of least privilege to 4 workflow files that were missing them: - test.yml: contents: read (only reads code and runs tests) - npm-publish.yml: contents: read top-level, contents: write for create-release-notes job that updates GitHub releases - macos-testing.yml: contents: read top-level, pull-requests: write for generate-report job that posts PR comments - publish-pro.yml: contents: read top-level (publish job already had job-level contents: write) This aligns with GitHub's security hardening recommendations: https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions Closes #210
1 parent a937ced commit 655c3e0

4 files changed

Lines changed: 17 additions & 0 deletions

File tree

.github/workflows/macos-testing.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ concurrency:
3232
group: macos-testing-${{ github.event.pull_request.number || github.ref }}
3333
cancel-in-progress: true
3434

35+
permissions:
36+
contents: read
37+
3538
jobs:
3639
# Job 1: Intel Mac Testing
3740
test-intel-mac:
@@ -213,6 +216,9 @@ jobs:
213216
runs-on: macos-latest
214217
needs: [test-intel-mac, test-apple-silicon, test-error-recovery]
215218
if: always()
219+
permissions:
220+
contents: read
221+
pull-requests: write
216222

217223
steps:
218224
- name: Checkout repository

.github/workflows/npm-publish.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ concurrency:
3333
group: npm-publish-${{ github.ref }}
3434
cancel-in-progress: false # Never cancel publishing in progress
3535

36+
permissions:
37+
contents: read
38+
3639
env:
3740
NODE_VERSION: '20'
3841
NPM_REGISTRY: 'https://registry.npmjs.org/'
@@ -342,6 +345,8 @@ jobs:
342345
needs: [build, publish, publish-aios-install]
343346
if: github.event_name == 'release' && (needs.publish.result == 'success' || needs.publish-aios-install.result == 'success')
344347
runs-on: ubuntu-latest
348+
permissions:
349+
contents: write
345350
steps:
346351
- name: Checkout code
347352
uses: actions/checkout@v4

.github/workflows/publish-pro.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ on:
2626
tags:
2727
- 'pro-v*'
2828

29+
permissions:
30+
contents: read
31+
2932
jobs:
3033
# ─────────────────────────────────────────────────────────────────────────────
3134
# Quality Gates - Must pass before publish

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ concurrency:
1717
group: test-${{ github.ref }}
1818
cancel-in-progress: true
1919

20+
permissions:
21+
contents: read
22+
2023
env:
2124
NODE_VERSION: '20'
2225

0 commit comments

Comments
 (0)