Skip to content

Commit 72a263b

Browse files
authored
Pin commit hash of github actions to avoid supply chain attacks (#680)
## 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. ## 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 #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 line/line-openapi#90
1 parent bab829c commit 72a263b

File tree

7 files changed

+29
-17
lines changed

7 files changed

+29
-17
lines changed

.github/workflows/check-eol-newrelease.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
if: github.repository == 'line/line-bot-sdk-php'
1616
steps:
1717
- name: Check out code
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1919

2020
- name: Run EoL & NewRelease check
21-
uses: actions/github-script@v7
21+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
2222
with:
2323
script: |
2424
const checkEolAndNewReleases = require('.github/scripts/check-eol-newrelease.cjs');

.github/workflows/close-issue.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
pull-requests: write
1414
if: github.repository == 'line/line-bot-sdk-php'
1515
steps:
16-
- uses: actions/stale@v9
16+
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0
1717
with:
1818
days-before-issue-stale: 14
1919
days-before-issue-close: 0

.github/workflows/generate-code.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,22 @@ jobs:
1717
pull-requests: write
1818
steps:
1919
# Setup
20-
- uses: actions/checkout@v4
20+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2121
with:
2222
submodules: recursive
2323
- name: Update submodules
2424
run: git submodule update --remote --recursive
25-
- uses: actions/setup-node@v4
25+
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
2626
id: setup_node_id
2727
with:
2828
node-version: 18
29-
- uses: shivammathur/setup-php@v2
29+
- uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # 2.32.0
3030
with:
3131
php-version: 8.2
3232

3333
# Install openapi-generator-cli
3434
- run: echo "OPENAPI_GENERATOR_VERSION=7.11.0" >> $GITHUB_ENV
35-
- uses: actions/cache@v4
35+
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
3636
id: openapi-generator-cache
3737
env:
3838
cache-name: openapi-generator-cache

.github/workflows/php-checks.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ jobs:
2727

2828
steps:
2929
- name: Checkout
30-
uses: actions/checkout@v4
30+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3131
with:
3232
submodules: recursive
3333
- name: Set up PHP ${{ matrix.php }}
34-
uses: shivammathur/setup-php@v2
34+
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # 2.32.0
3535
with:
3636
php-version: ${{ matrix.php }}
3737

3838
- name: Install openapi-generator-cli
3939
run: echo "OPENAPI_GENERATOR_VERSION=7.11.0" >> $GITHUB_ENV
40-
- uses: actions/cache@v4
40+
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
4141
id: openapi-generator-cache
4242
env:
4343
cache-name: openapi-generator-cache
@@ -62,15 +62,15 @@ jobs:
6262
run: |
6363
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
6464
65-
- uses: actions/cache@v4
65+
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
6666
with:
6767
path: ${{ steps.composer-cache.outputs.dir }}
6868
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
6969
restore-keys: |
7070
${{ runner.os }}-php-${{ matrix.php }}-
7171
7272
- name: Install dependencies with Composer
73-
uses: ramsey/composer-install@v2
73+
uses: ramsey/composer-install@a2636af0004d1c0499ffca16ac0b4cc94df70565 # 3.1.0
7474

7575
- name: Check copyrights
7676
if: matrix.analysis
@@ -91,3 +91,14 @@ jobs:
9191
- name: Run unit tests
9292
if: matrix.analysis
9393
run: ./vendor/bin/phpunit --test-suffix=Test.php --testdox
94+
95+
pinact:
96+
runs-on: ubuntu-latest
97+
permissions:
98+
contents: read
99+
steps:
100+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
101+
- name: Run pinact
102+
uses: suzuki-shunsuke/pinact-action@a6896d13d22e2bf108a78b0c52d3f867c1f41b34 # v0.2.1
103+
with:
104+
skip_push: "true"

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ jobs:
2525
issues: write
2626
steps:
2727
- name: Checkout
28-
uses: actions/checkout@v4
28+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2929
- name: Setup Pages
30-
uses: actions/configure-pages@v5
30+
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
3131
- name: Upload artifact
32-
uses: actions/upload-pages-artifact@v3
32+
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
3333
with:
3434
path: 'docs'
3535
- name: Deploy to GitHub Pages
3636
id: deployment
37-
uses: actions/deploy-pages@v4
37+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
3838

3939
- name: Create GitHub Issue on Failure
4040
if: failure()

renovate.json5

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
33
extends: [
44
'config:recommended',
5+
'helpers:pinGitHubActionDigestsToSemver'
56
],
67
timezone: 'Asia/Tokyo',
78
ignorePaths: [

0 commit comments

Comments
 (0)