Skip to content

Commit cc542e3

Browse files
authored
Pin commit hash of github actions to avoid supply chain attacks (#90)
## Changes To avoid supply chain attacks, specify actions in GitHub Actions workflows using commit hashes instead of version numbers. Pinact-action will fail the CI job if this is not done. Renovate already supports updates in the commit hash state, so there is no issue. (At this point, since this repository provides YAML, it might be considered unnecessary, but having it prepared doesn't hurt.) ## References - https://github.com/suzuki-shunsuke/pinact-action - does pinact-action verify the checksum of the version of aqua it is using? Yes!: - https://github.com/suzuki-shunsuke/pinact ## Other repositories - line/line-bot-sdk-python line/line-bot-sdk-python#772 - line/line-bot-sdk-php line/line-bot-sdk-php#680 - line/line-bot-sdk-nodejs line/line-bot-sdk-nodejs#1201 - line/line-bot-sdk-java line/line-bot-sdk-java#1576 - line/line-bot-sdk-go line/line-bot-sdk-go#555 - line/line-bot-sdk-ruby line/line-bot-sdk-ruby#405 - line/line-openapi #90
1 parent 9dec0f8 commit cc542e3

File tree

4 files changed

+43
-24
lines changed

4 files changed

+43
-24
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- uses: actions/checkout@v3
14+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1515
- name: Use Node.js
16-
uses: actions/setup-node@v3
16+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
1717
with:
1818
cache: 'npm'
1919
- run: npm install -g @stoplight/spectral-cli
@@ -26,16 +26,16 @@ jobs:
2626
runs-on: ubuntu-latest
2727

2828
steps:
29-
- uses: actions/checkout@v3
29+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3030
- name: Use Node.js
31-
uses: actions/setup-node@v3
31+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
3232
with:
3333
cache: 'npm'
3434
- run: npm install -g @openapitools/openapi-generator-cli
3535
- run: openapi-generator-cli version-manager set 7.0.1
3636
- run: sed -i -e 's/openapi-generator/openapi-generator-cli/g' ./tools/generate-test.mjs
3737
- name: actions/setup-java@v3 (JDK 17)
38-
uses: actions/setup-java@v3
38+
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
3939
with:
4040
distribution: 'temurin'
4141
java-version: 17
@@ -46,10 +46,19 @@ jobs:
4646
runs-on: ubuntu-latest
4747

4848
steps:
49-
- uses: actions/checkout@v3
50-
- uses: actions/setup-node@v3
49+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
50+
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
5151
with:
5252
cache: 'npm'
5353
- run: npx zx ./tools/reformat.mjs
5454
- name: Check there is no diff (Run ./tools/reformat.mjs if there is a diff)
5555
run: git diff --exit-code
56+
57+
pinact:
58+
runs-on: ubuntu-latest
59+
steps:
60+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
61+
- name: Run pinact
62+
uses: suzuki-shunsuke/pinact-action@a6896d13d22e2bf108a78b0c52d3f867c1f41b34 # v0.2.1
63+
with:
64+
skip_push: "true"

.github/workflows/close-issue.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
issues: write
1313
pull-requests: write
1414
steps:
15-
- uses: actions/stale@v9
15+
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
1616
with:
1717
days-before-issue-stale: 14
1818
days-before-issue-close: 0

.github/workflows/sdk-testing.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111

1212
steps:
1313
- name: Checkout SDK repo
14-
uses: actions/checkout@v4
14+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1515
with:
1616
repository: 'line/line-bot-sdk-java'
1717
submodules: recursive
@@ -28,7 +28,7 @@ jobs:
2828

2929
# https://github.com/line/line-bot-sdk-java/blob/master/.github/workflows/gradle.yml
3030
- name: Setup Java
31-
uses: actions/setup-java@v3
31+
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
3232
with:
3333
distribution: 'temurin'
3434
java-version: '17'
@@ -55,7 +55,7 @@ jobs:
5555

5656
steps:
5757
- name: Checkout SDK repo
58-
uses: actions/checkout@v4
58+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5959
with:
6060
repository: 'line/line-bot-sdk-python'
6161
submodules: recursive
@@ -72,7 +72,7 @@ jobs:
7272

7373
# https://github.com/line/line-bot-sdk-python/blob/master/.github/workflows/auto-testing.yml
7474
- name: Setup Python
75-
uses: actions/setup-python@v4
75+
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
7676
with:
7777
distribution: 'temurin'
7878
python-version: '3.11'
@@ -108,7 +108,7 @@ jobs:
108108

109109
steps:
110110
- name: Checkout SDK repo
111-
uses: actions/checkout@v4
111+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
112112
with:
113113
repository: 'line/line-bot-sdk-php'
114114
submodules: recursive
@@ -125,14 +125,14 @@ jobs:
125125

126126
# https://github.com/line/line-bot-sdk-php/blob/master/.github/workflows/php-checks.yml
127127
- name: Setup PHP
128-
uses: shivammathur/setup-php@v2
128+
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # 2.32.0
129129
with:
130130
distribution: 'temurin'
131131
php-version: '8.2'
132132

133133
- name: Install openapi-generator-cli
134134
run: echo "OPENAPI_GENERATOR_VERSION=7.11.0" >> $GITHUB_ENV
135-
- uses: actions/cache@v3
135+
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
136136
id: openapi-generator-cache
137137
env:
138138
cache-name: openapi-generator-cache
@@ -157,15 +157,15 @@ jobs:
157157
run: |
158158
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
159159
160-
- uses: actions/cache@v3
160+
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
161161
with:
162162
path: ${{ steps.composer-cache.outputs.dir }}
163163
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
164164
restore-keys: |
165165
${{ runner.os }}-php-${{ matrix.php }}-
166166
167167
- name: Install dependencies with Composer
168-
uses: ramsey/composer-install@v2
168+
uses: ramsey/composer-install@a2636af0004d1c0499ffca16ac0b4cc94df70565 # 3.1.0
169169

170170
- name: Show diff
171171
run: |
@@ -186,7 +186,7 @@ jobs:
186186

187187
steps:
188188
- name: Checkout SDK repo
189-
uses: actions/checkout@v4
189+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
190190
with:
191191
repository: 'line/line-bot-sdk-nodejs'
192192
submodules: recursive
@@ -203,14 +203,14 @@ jobs:
203203

204204
# https://github.com/line/line-bot-sdk-nodejs/blob/master/.github/workflows/test.yml
205205
- name: actions/setup-java@v3
206-
uses: actions/setup-java@v3
206+
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
207207
with:
208208
distribution: 'temurin'
209209
java-version: 17
210210
architecture: x64
211211

212212
- name: Setup Node.js
213-
uses: actions/setup-node@v4
213+
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
214214
with:
215215
node-version: '20'
216216

@@ -239,7 +239,7 @@ jobs:
239239

240240
steps:
241241
- name: Checkout SDK repo
242-
uses: actions/checkout@v4
242+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
243243
with:
244244
repository: 'line/line-bot-sdk-go'
245245
submodules: recursive
@@ -256,19 +256,19 @@ jobs:
256256

257257
# https://github.com/line/line-bot-sdk-go/blob/master/.github/workflows/go.yml
258258
- name: actions/setup-java@v3
259-
uses: actions/setup-java@v3
259+
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
260260
with:
261261
distribution: 'temurin'
262262
java-version: 17
263263
architecture: x64
264264

265265
- name: Set up Python
266-
uses: actions/setup-python@v4
266+
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
267267
with:
268268
python-version: '3.x'
269269

270270
- name: Set up Go
271-
uses: actions/setup-go@v4
271+
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
272272
with:
273273
go-version: 1.21
274274

renovate.json5

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"config:recommended",
5+
"helpers:pinGitHubActionDigestsToSemver"
6+
],
7+
"timezone": "Asia/Tokyo",
8+
"automerge": true,
9+
"platformAutomerge": true,
10+
}

0 commit comments

Comments
 (0)