Skip to content

Commit 53b6203

Browse files
ci: Add explicit permissions to workflows (#305)
1 parent 39ec4ec commit 53b6203

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

.github/workflows/ci.yml

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
name: CI
22
on: workflow_call
3+
permissions: {}
34
jobs:
45
test:
56
runs-on: ubuntu-latest
7+
permissions:
8+
contents: read # for actions/checkout
69
steps:
710
- name: Checkout repo
811
uses: actions/checkout@v3
@@ -30,6 +33,8 @@ jobs:
3033
lint:
3134
name: Lint source files
3235
runs-on: ubuntu-latest
36+
permissions:
37+
contents: read # for actions/checkout
3338
steps:
3439
- name: Checkout repo
3540
uses: actions/checkout@v3
@@ -65,6 +70,8 @@ jobs:
6570
checkForCommonlyIgnoredFiles:
6671
name: Check for commonly ignored files
6772
runs-on: ubuntu-latest
73+
permissions:
74+
contents: read # for actions/checkout
6875
steps:
6976
- name: Checkout repo
7077
uses: actions/checkout@v3
@@ -89,6 +96,8 @@ jobs:
8996
checkPackageLock:
9097
name: Check health of package-lock.json file
9198
runs-on: ubuntu-latest
99+
permissions:
100+
contents: read # for actions/checkout
92101
steps:
93102
- name: Checkout repo
94103
uses: actions/checkout@v3
@@ -114,7 +123,8 @@ jobs:
114123
name: Run CodeQL security scan
115124
runs-on: ubuntu-latest
116125
permissions:
117-
security-events: write
126+
contents: read # for actions/checkout
127+
security-events: write # for codeql-action
118128
steps:
119129
- name: Checkout repo
120130
uses: actions/checkout@v3
@@ -132,6 +142,8 @@ jobs:
132142
buildDemo:
133143
name: Build Demo
134144
runs-on: ubuntu-latest
145+
permissions:
146+
contents: read # for actions/checkout
135147
steps:
136148
- name: Checkout repo
137149
uses: actions/checkout@v3
@@ -162,6 +174,8 @@ jobs:
162174
buildRelease:
163175
name: Build release
164176
runs-on: ubuntu-latest
177+
permissions:
178+
contents: read # for actions/checkout
165179
steps:
166180
- name: Checkout repo
167181
uses: actions/checkout@v3

.github/workflows/pull_request.yml

+6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
name: PullRequest
22
on: pull_request
3+
permissions: {}
34
jobs:
45
ci:
6+
permissions:
7+
contents: read # for actions/checkout
8+
security-events: write # for codeql-action
59
uses: ./.github/workflows/ci.yml
610

711
dependency-review:
812
name: Security check of added dependencies
913
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read # for actions/checkout
1016
steps:
1117
- name: Checkout repo
1218
uses: actions/checkout@v3

.github/workflows/push.yml

+7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
name: Push
22
on: push
3+
permissions: {}
34
jobs:
45
ci:
6+
permissions:
7+
contents: read # for actions/checkout
8+
security-events: write # for codeql-action
59
uses: ./.github/workflows/ci.yml
10+
611
deploy-to-gh-pages:
712
name: Deploy to `npm` branch
813
needs: ci
@@ -11,6 +16,8 @@ jobs:
1116
name: github-pages
1217
url: ${{ github.server_url }}/${{ github.repository }}/tree/gh-pages
1318
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read # for actions/checkout
1421
steps:
1522
- name: Checkout `gh-pages` branch
1623
uses: actions/checkout@v3

0 commit comments

Comments
 (0)