Skip to content

Commit 273eb66

Browse files
committed
GH Actions: "pin" all action runners
Recently there has been more and more focus on securing GH Actions workflows - in part due to some incidents. The problem with "unpinned" action runners is as follows: * Tags are mutable, which means that a tag could point to a safe commit today, but to a malicious commit tomorrow. Note that GitHub is currently beta-testing a new "immutable releases" feature (= tags and release artifacts can not be changed anymore once the release is published), but whether that has much effect depends on the ecosystem of the packages using the feature. Aside from that, it will likely take years before all projects adopt _immutable releases_. * Action runners often don't even point to a tag, but to a branch, making the used action runner a moving target. _Note: this type of "floating major" for action runners used to be promoted as good practice when the ecosystem was "young". Insights have since changed._ While it is convenient to use "floating majors" of action runners, as this means you only need to update the workflows on a new major release of the action runner, the price is higher risk of malicious code being executed in workflows. Dependabot, by now, can automatically submit PRs to update pinned action runners too, as long as the commit-hash pinned runner is followed by a comment listing the released version the commit is pointing to. So, what with Dependabot being capable of updating workflows with pinned action runners, I believe it is time to update the workflows to the _current_ best practice of using commit-hash pinned action runners. The downside of this change is that there will be more frequent Dependabot PRs. If this would become a burden/irritating, the following mitigations can be implemented: 1. Updating the Dependabot config to group updates instead of sending individual PRs per action runner. 2. A workflow to automatically merge Dependabot PRs as long as CI passes. Ref: https://docs.github.com/en/actions/reference/security/secure-use#using-third-party-actions
1 parent 35b7cad commit 273eb66

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

.github/workflows/basic-qa.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ jobs:
3030

3131
steps:
3232
- name: Checkout code
33-
uses: actions/checkout@v5
33+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3434

3535
- name: Restore lychee cache
36-
uses: actions/cache@v4
36+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
3737
with:
3838
path: .lycheecache
3939
key: cache-lychee-${{ github.sha }}
4040
restore-keys: cache-lychee-
4141

4242
- name: Link Checker
43-
uses: lycheeverse/lychee-action@v2
43+
uses: lycheeverse/lychee-action@885c65f3dc543b57c898c8099f4e08c8afd178a2 # v2.6.1
4444
with:
4545
# Sidebar file exclusion is needed to work-around an upstream bug.
4646
# Should be removed once bug https://github.com/lycheeverse/lychee/issues/1788 has been fixed.
@@ -57,10 +57,10 @@ jobs:
5757

5858
steps:
5959
- name: Checkout code
60-
uses: actions/checkout@v5
60+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
6161

6262
- name: Spellcheck
63-
uses: streetsidesoftware/cspell-action@v7
63+
uses: streetsidesoftware/cspell-action@dcd03dc3e8a59ec2e360d0c62db517baa0b4bb6d # v7.2.0
6464
with:
6565
# Define glob patterns to filter the files to be checked. Use a new line between patterns to define multiple patterns.
6666
files: '**/*.md'
@@ -80,14 +80,14 @@ jobs:
8080

8181
steps:
8282
- name: Checkout code
83-
uses: actions/checkout@v5
83+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
8484

8585
- name: Set up problem matcher
86-
uses: lumaxis/shellcheck-problem-matchers@v2
86+
uses: lumaxis/shellcheck-problem-matchers@b02a1715a00c729b20eed3ebb7edf56fa9a433ba # v2.1.0
8787
with:
8888
format: gcc
8989

9090
- name: Run ShellCheck
91-
uses: ludeeus/[email protected]
91+
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 # 2.0.0
9292
with:
9393
format: gcc

.github/workflows/label-merge-conflicts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
steps:
2323
- name: Check PRs for merge conflicts
24-
uses: eps1lon/actions-label-merge-conflict@v3
24+
uses: eps1lon/actions-label-merge-conflict@1df065ebe6e3310545d4f4c4e862e43bdca146f0 # v3.0.3
2525
with:
2626
dirtyLabel: "Status: has merge conflict"
2727
repoToken: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/label-new-prs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525

2626
steps:
2727
- name: Label new PRs
28-
uses: srvaroa/labeler@v1
28+
uses: srvaroa/labeler@9c29ad1ef33d169f9ef33c52722faf47a566bcf3 # v1
2929
env:
3030
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
3131

@@ -38,10 +38,10 @@ jobs:
3838
steps:
3939
# Checkout is needed to use the `use_local_config` option.
4040
- name: Checkout code
41-
uses: actions/checkout@v5
41+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4242

4343
- name: Verify changes to the labeling logic
44-
uses: srvaroa/labeler@v1
44+
uses: srvaroa/labeler@9c29ad1ef33d169f9ef33c52722faf47a566bcf3 # v1
4545
with:
4646
use_local_config: true
4747
fail_on_error: true

.github/workflows/label-remove-outdated.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
name: Clean up labels on issue close
1919

2020
steps:
21-
- uses: mondeja/remove-labels-gh-action@v2
21+
- uses: mondeja/remove-labels-gh-action@b7118e4ba5dca74acf1059b3cb7660378ff9ab1a # v2.0.0
2222
with:
2323
token: ${{ secrets.GITHUB_TOKEN }}
2424
labels: |
@@ -35,7 +35,7 @@ jobs:
3535
name: "Clean up labels on PR (re-)review request"
3636

3737
steps:
38-
- uses: mondeja/remove-labels-gh-action@v2
38+
- uses: mondeja/remove-labels-gh-action@b7118e4ba5dca74acf1059b3cb7660378ff9ab1a # v2.0.0
3939
with:
4040
token: ${{ secrets.GITHUB_TOKEN }}
4141
labels: |
@@ -48,7 +48,7 @@ jobs:
4848
name: Clean up labels on PR merge
4949

5050
steps:
51-
- uses: mondeja/remove-labels-gh-action@v2
51+
- uses: mondeja/remove-labels-gh-action@b7118e4ba5dca74acf1059b3cb7660378ff9ab1a # v2.0.0
5252
with:
5353
token: ${{ secrets.GITHUB_TOKEN }}
5454
labels: |
@@ -68,7 +68,7 @@ jobs:
6868
name: Clean up labels on PR close
6969

7070
steps:
71-
- uses: mondeja/remove-labels-gh-action@v2
71+
- uses: mondeja/remove-labels-gh-action@b7118e4ba5dca74acf1059b3cb7660378ff9ab1a # v2.0.0
7272
with:
7373
token: ${{ secrets.GITHUB_TOKEN }}
7474
labels: |

.github/workflows/pr-comment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
steps:
3131
- name: Download PR info artifact
32-
uses: actions/github-script@v8
32+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
3333
with:
3434
script: |
3535
const allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
@@ -75,7 +75,7 @@ jobs:
7575
echo "URL=$value" >> "$GITHUB_OUTPUT"
7676
7777
- name: "Post comment to review artifact"
78-
uses: mshick/add-pr-comment@v2
78+
uses: mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2.8.2
7979
with:
8080
issue: ${{ steps.pr_number.outputs.PR_NR }}
8181
repo-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish-wiki.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ jobs:
4343

4444
steps:
4545
- name: Checkout code
46-
uses: actions/checkout@v5
46+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4747

4848
- name: Install PHP
49-
uses: shivammathur/setup-php@v2
49+
uses: shivammathur/setup-php@ec406be512d7077f68eed36e63f4d91bc006edc4 # 2.35.4
5050
with:
5151
php-version: 'latest'
5252
ini-values: error_reporting=-1, display_errors=On, display_startup_errors=On, log_errors_max_len=0
@@ -119,7 +119,7 @@ jobs:
119119
- name: "[PR only] Upload the preprocessed wiki files as an artifact"
120120
if: ${{ github.event_name == 'pull_request' }}
121121
id: artifact
122-
uses: actions/upload-artifact@v4
122+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
123123
with:
124124
name: wiki-files
125125
path: ./_wiki
@@ -132,13 +132,13 @@ jobs:
132132
# ################################################################################
133133

134134
- name: Check GitHub Git Operations status
135-
uses: crazy-max/ghaction-github-status@v4
135+
uses: crazy-max/ghaction-github-status@fa6ac37620bc5d44b93e15caed498629665e9ff5 # v4.2.0
136136
with:
137137
git_threshold: partial_outage
138138

139139
- name: Deploy to wiki
140140
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
141-
uses: Andrew-Chen-Wang/[email protected]
141+
uses: Andrew-Chen-Wang/github-wiki-action@2c80c13ee98aa43683bd77973ef4916e2eedf817 # v5.0.1
142142
env:
143143
COMMIT_MSG: ${{ github.event.head_commit.message }}
144144
DEFAULT_COMMIT_MSG: "Update wiki ${{ github.sha }}"
@@ -175,7 +175,7 @@ jobs:
175175

176176
- name: Upload PR info as artifact
177177
if: ${{ github.event_name == 'pull_request' }}
178-
uses: actions/upload-artifact@v4
178+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
179179
with:
180180
name: pr_info
181181
path: pr/

0 commit comments

Comments
 (0)