Skip to content

Commit bcc86af

Browse files
committed
chore: Lock the versions of GitHub Actions used in workflows to SHA hashes, to prevent compromised actions from being used.
Also disable the bundler-cache in the release job, to protect against the release job pulling a compromised cache and thus pushing a compromised gem. And set a 1 day cooldown on github actions updates, just to be safe and hopefully prevent any update to a malicious version of an action. These changes were all made using zizmor / manual edits by me.
1 parent db560b7 commit bcc86af

4 files changed

Lines changed: 34 additions & 17 deletions

File tree

.github/dependabot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ updates:
55
directory: "/"
66
schedule:
77
interval: "weekly"
8+
cooldown:
9+
default-days: 1

.github/workflows/deploy_docs.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ jobs:
1212
permissions:
1313
contents: write
1414
steps:
15-
- uses: actions/checkout@v6
15+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
16+
with:
17+
persist-credentials: false
1618
- name: Set up Ruby
17-
uses: ruby/setup-ruby@v1
19+
uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1.310.0
1820
with:
1921
ruby-version: ruby
2022
bundler-cache: true
@@ -27,7 +29,7 @@ jobs:
2729
- name: Configure CNAME
2830
run: echo "ruby-jwt.org" > ./doc/CNAME
2931
- name: Deploy
30-
uses: peaceiris/actions-gh-pages@v4
32+
uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4.1.0
3133
with:
3234
github_token: ${{ secrets.GITHUB_TOKEN }}
3335
publish_dir: ./doc

.github/workflows/push_gem.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
push:
44
tags:
55
- v*
6+
67
name: Push Gem
78
jobs:
89
push:
@@ -11,20 +12,22 @@ jobs:
1112
contents: write
1213
id-token: write
1314
steps:
14-
- uses: rubygems/configure-rubygems-credentials@main
15+
- uses: rubygems/configure-rubygems-credentials@762a4b77c3300434bb57c7ce80b20e36231927aa # v2.0.0
1516
with:
1617
role-to-assume: ${{ secrets.RUBYGEMS_PUSH_ROLE }}
17-
- uses: actions/checkout@v6
18+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
19+
with:
20+
persist-credentials: false
1821
- name: Set remote URL
1922
run: |
2023
# Attribute commits to the last committer on HEAD
2124
git config --global user.email "$(git log -1 --pretty=format:'%ae')"
2225
git config --global user.name "$(git log -1 --pretty=format:'%an')"
2326
git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY"
2427
- name: Set up Ruby
25-
uses: ruby/setup-ruby@v1
28+
uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1.310.0
2629
with:
27-
bundler-cache: true
30+
bundler-cache: false
2831
ruby-version: ruby
2932
- name: Release
3033
run: bundle exec rake release

.github/workflows/test.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
permissions: read-all
33
name: test
4+
45
on:
56
push:
67
branches:
@@ -10,15 +11,18 @@ on:
1011
- "*"
1112
schedule:
1213
- cron: "0 0 * * 5"
14+
1315
jobs:
1416
rubocop:
1517
name: RuboCop
1618
timeout-minutes: 30
1719
runs-on: ubuntu-latest
1820
steps:
19-
- uses: actions/checkout@v6
21+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
22+
with:
23+
persist-credentials: false
2024
- name: Set up Ruby
21-
uses: ruby/setup-ruby@v1
25+
uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1.310.0
2226
with:
2327
ruby-version: ruby
2428
bundler-cache: true
@@ -62,10 +66,12 @@ jobs:
6266
env:
6367
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
6468
steps:
65-
- uses: actions/checkout@v6
69+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
70+
with:
71+
persist-credentials: false
6672

6773
- name: Set up Ruby
68-
uses: ruby/setup-ruby@v1
74+
uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1.310.0
6975
with:
7076
ruby-version: ${{ matrix.ruby }}
7177
bundler-cache: true
@@ -77,7 +83,7 @@ jobs:
7783
run: echo "SANITIZED_GEMFILE=${{ matrix.gemfile }}" | tr '/' '-' >> $GITHUB_ENV
7884

7985
- name: Upload test coverage folder for later reporting
80-
uses: actions/upload-artifact@v7
86+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
8187
with:
8288
name: coverage-${{ matrix.os }}-${{ matrix.ruby }}-${{ env.SANITIZED_GEMFILE }}
8389
path: coverage/*.json
@@ -89,12 +95,14 @@ jobs:
8995
needs: test
9096
if: success()
9197
steps:
92-
- uses: actions/checkout@v6
98+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
99+
with:
100+
persist-credentials: false
93101

94102
- name: Download coverage reports from the test job
95-
uses: actions/download-artifact@v8
103+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
96104

97-
- uses: qltysh/qlty-action/coverage@v2
105+
- uses: qltysh/qlty-action/coverage@a19242102d17e497f437d7466aa01b528537e899 # v2.2.0
98106
with:
99107
token: ${{ secrets.QLTY_COVERAGE_TOKEN }}
100108
files: coverage-*/*.json
@@ -104,9 +112,11 @@ jobs:
104112
timeout-minutes: 30
105113
runs-on: ubuntu-latest
106114
steps:
107-
- uses: actions/checkout@v6
115+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
116+
with:
117+
persist-credentials: false
108118
- name: Set up Ruby
109-
uses: ruby/setup-ruby@v1
119+
uses: ruby/setup-ruby@afeafc3d1ab54a631816aba4c914a0081c12ff2f # v1.310.0
110120
with:
111121
ruby-version: ruby
112122
- name: Build GEM

0 commit comments

Comments
 (0)