Skip to content

Commit 46afcb3

Browse files
authored
Merge pull request #157 from Ultramarine-Linux/gil/sec/actions
security(ci): Harden Actions
2 parents edc8bd0 + a41828c commit 46afcb3

2 files changed

Lines changed: 21 additions & 16 deletions

File tree

.github/workflows/build-docker.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
name: Build Docker images
2+
permissions:
3+
contents: read
24
env:
35
KATSU_BUILD_TASK_NAME: "Build image"
46
REGISTRY: ghcr.io
@@ -36,7 +38,7 @@ jobs:
3638
steps:
3739

3840
- name: Checkout
39-
uses: actions/checkout@v4
41+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4042

4143
- name: sanitize artifact name
4244
run: |
@@ -64,7 +66,7 @@ jobs:
6466
popd
6567
6668
- name: Upload Artifact
67-
uses: actions/upload-artifact@v4
69+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
6870
with:
6971
name: ${{ env.artifact }}-docker
7072
path: katsu/katsu-work/image/*.tar.xz
@@ -81,7 +83,7 @@ jobs:
8183
- name: Install dependencies
8284
run: sudo apt-get update && sudo apt-get install -y buildah
8385
- name: Log in to ghcr.io
84-
uses: redhat-actions/podman-login@v1
86+
uses: redhat-actions/podman-login@4934294ad0449894bcd1e9f191899d7292469603 # v1
8587
with:
8688
username: ${{ github.repository_owner }}
8789
password: ${{ secrets.GITHUB_TOKEN }}
@@ -90,7 +92,7 @@ jobs:
9092
# how do i combine those two images into one multiarch tag
9193

9294
- name: Download artifacts
93-
uses: actions/download-artifact@v4
95+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
9496

9597
- name: Publish to registry
9698
run: |
@@ -124,20 +126,20 @@ jobs:
124126

125127
steps:
126128
- name: Checkout
127-
uses: actions/checkout@v2
129+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
128130
- name: Set up QEMU
129-
uses: docker/setup-qemu-action@v3
131+
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
130132
- name: Set up Docker Buildx
131-
uses: docker/setup-buildx-action@v3
133+
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
132134
- name: Log into registry ${{ env.REGISTRY }}
133-
uses: docker/login-action@v2.1.0
135+
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
134136
with:
135137
registry: ${{ env.REGISTRY }}
136138
username: ${{ github.actor }}
137139
password: ${{ secrets.GITHUB_TOKEN }}
138140

139141
- name: Build images
140-
uses: docker/build-push-action@v6
142+
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
141143
with:
142144
context: .
143145
file: ${{ matrix.docker.dockerfile }}

.github/workflows/build-katsu.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Build images (with Katsu)
22

3+
permissions:
4+
contents: read
5+
36
env:
47
KATSU_BUILD_TASK_NAME: "Build image"
58

@@ -74,7 +77,7 @@ jobs:
7477

7578
steps:
7679
- name: Checkout
77-
uses: actions/checkout@v4
80+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
7881
- name: sanitize artifact name
7982
run: |
8083
name=$(echo ${{ matrix.variant }} | sed 's/\//-/g')
@@ -98,7 +101,7 @@ jobs:
98101
popd
99102
100103
- name: Upload Artifact
101-
uses: actions/upload-artifact@v4
104+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
102105
with:
103106
name: ${{ env.artifact }}-image
104107
path: katsu/katsu-work/image/*.img.zst
@@ -157,7 +160,7 @@ jobs:
157160
# e.g. budgie/budgie-live -> budgie
158161
echo variant=$(echo ${{ matrix.variant }} | cut -d'/' -f1) >> $GITHUB_ENV
159162
- name: Checkout
160-
uses: actions/checkout@v4
163+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
161164
- name: Clean up space before build
162165
run: |
163166
df -h
@@ -204,7 +207,7 @@ jobs:
204207
popd
205208
206209
- name: Upload Artifact
207-
uses: actions/upload-artifact@v4
210+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
208211
with:
209212
name: ${{ env.artifact }}-iso
210213
path: katsu/*.iso
@@ -229,7 +232,7 @@ jobs:
229232
options: --privileged -v /dev:/dev
230233
steps:
231234
- name: Checkout
232-
uses: actions/checkout@v4
235+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
233236
- name: sanitize artifact name
234237
run: |
235238
name=$(echo ${{ matrix.variant }} | sed 's/\//-/g')
@@ -261,7 +264,7 @@ jobs:
261264
popd
262265
263266
- name: Upload Artifact
264-
uses: actions/upload-artifact@v4
267+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
265268
with:
266269
name: ${{ env.artifact }}-tar
267270
path: |
@@ -284,7 +287,7 @@ jobs:
284287

285288
steps:
286289
- name: Download artifacts
287-
uses: actions/download-artifact@v4
290+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
288291
with:
289292
path: artifacts
290293

0 commit comments

Comments
 (0)