Skip to content

Commit 24cb9e2

Browse files
committed
Harden GitHub Actions workflows
- Pin every action ref to a full-length commit SHA with a trailing version comment, so floating tags like @v4 can't be re-pointed at malicious code. - Bump outdated actions/checkout@v1 to @v4.3.1 (where present). - Tag-triggered workflows now check out with fetch-depth: 1 and fetch-tags: true so the tag ref is available downstream. - release-tracker.yml grants contents: write at the job level so the default GITHUB_TOKEN can push commits/tags back to the repo. Signed-off-by: Tamal Saha <tamal@appscode.com>
1 parent 12dfe1b commit 24cb9e2

5 files changed

Lines changed: 21 additions & 13 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ jobs:
1919
runs-on: ubuntu-24.04
2020
steps:
2121
- name: Set up Go 1.25
22-
uses: actions/setup-go@v5
22+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
2323
with:
2424
go-version: '1.25'
2525
id: go
2626

2727
- name: Check out code into the Go module directory
28-
uses: actions/checkout@v4
28+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
2929

3030
- name: Prepare Host
3131
run: |
@@ -63,7 +63,7 @@ jobs:
6363
matrix:
6464
k8s: [v1.28.15, v1.30.13, v1.32.5, v1.34.0]
6565
steps:
66-
- uses: actions/checkout@v4
66+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
6767

6868
- name: Install yq
6969
run: |
@@ -73,7 +73,7 @@ jobs:
7373
7474
- name: Create Kubernetes ${{ matrix.k8s }} cluster
7575
id: kind
76-
uses: engineerd/setup-kind@v0.5.0
76+
uses: engineerd/setup-kind@aa272fe2a7309878ffc2a81c56cfe3ef108ae7d0 # v0.5.0
7777
with:
7878
version: v0.29.0
7979
image: kindest/node:${{ matrix.k8s }}

‎.github/workflows/cve-report.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
name: Report
1515
runs-on: ubuntu-24.04
1616
steps:
17-
- uses: actions/checkout@v4
17+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
1818

1919
- name: Set up Go
20-
uses: actions/setup-go@v5
20+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
2121
with:
2222
go-version: '1.25'
2323

@@ -61,7 +61,7 @@ jobs:
6161
git commit -s -a -m "Update cve report $(date --rfc-3339=date)"
6262
6363
- name: Create Pull Request
64-
uses: peter-evans/create-pull-request@v6
64+
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
6565
with:
6666
token: ${{ secrets.LGTM_GITHUB_TOKEN }}
6767
title: Update cve report

‎.github/workflows/publish-oci.yml‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,22 @@ jobs:
1616
runs-on: ubuntu-24.04
1717
steps:
1818
- name: Check out code into the Go module directory
19-
uses: actions/checkout@v1
19+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
20+
with:
21+
fetch-depth: 1
22+
fetch-tags: true
2023

2124
- name: Set up QEMU
2225
id: qemu
23-
uses: docker/setup-qemu-action@v3
26+
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
2427
with:
2528
cache-image: false
2629

2730
- name: Set up Docker Buildx
28-
uses: docker/setup-buildx-action@v3
31+
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
2932

3033
- name: Log in to the GitHub Container registry
31-
uses: docker/login-action@v2
34+
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
3235
with:
3336
registry: ghcr.io
3437
username: 1gtm

‎.github/workflows/release-tracker.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ concurrency:
1212
jobs:
1313
build:
1414
runs-on: ubuntu-24.04
15+
permissions:
16+
contents: write
1517

1618
steps:
17-
- uses: actions/checkout@v4
19+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
1820

1921
- name: Prepare git
2022
env:

‎.github/workflows/release.yml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ jobs:
1616
runs-on: ubuntu-24.04
1717
steps:
1818
- name: Check out code into the Go module directory
19-
uses: actions/checkout@v1
19+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
20+
with:
21+
fetch-depth: 1
22+
fetch-tags: true
2023

2124
- name: Install GitHub CLI
2225
run: |

0 commit comments

Comments
 (0)