Skip to content

Commit 86780cb

Browse files
authored
Refine job-level permissions to enhance supply chain security (#92)
## Changes This PR specifies minimal permissions on each job to reduce unnecessary access to repository contents and avoid potential security risks. By granting only the required scopes (e.g. read-only for repository contents and write access only for issues to post PR comments), we can protect the supply chain from unintended privilege escalations.
1 parent cc542e3 commit 86780cb

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ on:
99
jobs:
1010
setup:
1111
runs-on: ubuntu-latest
12-
12+
permissions:
13+
contents: read
1314
steps:
1415
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1516
- name: Use Node.js
@@ -24,7 +25,8 @@ jobs:
2425

2526
generate-test:
2627
runs-on: ubuntu-latest
27-
28+
permissions:
29+
contents: read
2830
steps:
2931
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3032
- name: Use Node.js
@@ -44,7 +46,8 @@ jobs:
4446

4547
format-diff:
4648
runs-on: ubuntu-latest
47-
49+
permissions:
50+
contents: read
4851
steps:
4952
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5053
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0

.github/workflows/sdk-testing.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ on:
88
jobs:
99
test-java:
1010
runs-on: ubuntu-latest
11-
11+
permissions:
12+
contents: read
13+
pull-requests: write
1214
steps:
1315
- name: Checkout SDK repo
1416
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -52,7 +54,9 @@ jobs:
5254

5355
test-python:
5456
runs-on: ubuntu-latest
55-
57+
permissions:
58+
contents: read
59+
pull-requests: write
5660
steps:
5761
- name: Checkout SDK repo
5862
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -74,7 +78,6 @@ jobs:
7478
- name: Setup Python
7579
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
7680
with:
77-
distribution: 'temurin'
7881
python-version: '3.11'
7982

8083
- name: Install dependencies
@@ -96,16 +99,14 @@ jobs:
9699
language: python
97100
github-token: ${{ secrets.GITHUB_TOKEN }}
98101

99-
- name: Update version in linebot/__about__.py
100-
run: |
101-
sed -i "s/__version__ = '__LINE_BOT_SDK_PYTHON_VERSION__'/__version__ = '12.34.5'/g" linebot/__about__.py
102-
103102
- name: Test with pytest
104103
run: tox
105104

106105
test-php:
107106
runs-on: ubuntu-latest
108-
107+
permissions:
108+
contents: read
109+
pull-requests: write
109110
steps:
110111
- name: Checkout SDK repo
111112
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -127,7 +128,6 @@ jobs:
127128
- name: Setup PHP
128129
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # 2.32.0
129130
with:
130-
distribution: 'temurin'
131131
php-version: '8.2'
132132

133133
- name: Install openapi-generator-cli
@@ -183,7 +183,9 @@ jobs:
183183

184184
test-nodejs:
185185
runs-on: ubuntu-latest
186-
186+
permissions:
187+
contents: read
188+
pull-requests: write
187189
steps:
188190
- name: Checkout SDK repo
189191
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -202,7 +204,7 @@ jobs:
202204
PR_REF: ${{ github.event.pull_request.head.ref }}
203205

204206
# https://github.com/line/line-bot-sdk-nodejs/blob/master/.github/workflows/test.yml
205-
- name: actions/setup-java@v3
207+
- name: Setup Java
206208
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
207209
with:
208210
distribution: 'temurin'
@@ -236,7 +238,9 @@ jobs:
236238

237239
test-go:
238240
runs-on: ubuntu-latest
239-
241+
permissions:
242+
contents: read
243+
pull-requests: write
240244
steps:
241245
- name: Checkout SDK repo
242246
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -255,7 +259,7 @@ jobs:
255259
PR_REF: ${{ github.event.pull_request.head.ref }}
256260

257261
# https://github.com/line/line-bot-sdk-go/blob/master/.github/workflows/go.yml
258-
- name: actions/setup-java@v3
262+
- name: Setup Java
259263
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
260264
with:
261265
distribution: 'temurin'

0 commit comments

Comments
 (0)