Skip to content

Commit 38aa333

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 e7c2813 commit 38aa333

3 files changed

Lines changed: 14 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ 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: Use Node.js 20.x
28-
uses: actions/setup-node@v4
28+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
2929
with:
3030
node-version: '20'
3131
check-latest: true
3232

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

3636
- name: Prepare git
3737
env:

.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: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@ jobs:
1515
name: Build
1616
runs-on: firecracker
1717
steps:
18-
- uses: actions/checkout@v1
18+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
19+
with:
20+
fetch-depth: 1
21+
fetch-tags: true
1922

2023
- name: Set up Go 1.25
21-
uses: actions/setup-go@v5
24+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
2225
with:
2326
go-version: '1.25'
2427
id: go
@@ -47,12 +50,12 @@ jobs:
4750
4851
- name: Set up QEMU
4952
id: qemu
50-
uses: docker/setup-qemu-action@v3
53+
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
5154
with:
5255
cache-image: false
5356

5457
- name: Set up Docker Buildx
55-
uses: docker/setup-buildx-action@v3
58+
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
5659

5760
- name: Publish to GitHub Container Registry
5861
env:
@@ -75,7 +78,7 @@ jobs:
7578
# make docker-certify-redhat
7679

7780
- name: Release
78-
uses: softprops/action-gh-release@v1
81+
uses: softprops/action-gh-release@26994186c0ac3ef5cae75ac16aa32e8153525f77 # v1
7982
if: startsWith(github.ref, 'refs/tags/')
8083
with:
8184
files: |

0 commit comments

Comments
 (0)