Skip to content

Commit 685c624

Browse files
authored
Merge pull request #441 from posit-dev/security/binary-checksums
Add checksum verification to composite actions
2 parents 175760c + e8e80ec commit 685c624

2 files changed

Lines changed: 36 additions & 6 deletions

File tree

setup-goss/action.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,34 @@ runs:
2525
if [ -z "$arch" ]; then
2626
arch=$(uname -m)
2727
fi
28-
28+
2929
# Map architecture names to goss naming conventions
3030
if [ "$arch" = "x86_64" ]; then
3131
arch="amd64"
3232
elif [ "$arch" = "aarch64" ]; then
3333
arch="arm64"
3434
fi
35-
36-
curl -fsSL https://github.com/goss-org/goss/releases/${{ inputs.version }}/download/goss-linux-${arch} -o tools/goss
35+
36+
release_url="https://github.com/goss-org/goss/releases/${{ inputs.version }}/download"
37+
binary="goss-linux-${arch}"
38+
39+
curl -fsSL "${release_url}/${binary}" -o "tools/${binary}"
40+
41+
curl -fsSL "${release_url}/${binary}.sha256" -o "tools/${binary}.sha256"
42+
(cd tools && sha256sum -c "${binary}.sha256")
43+
rm -f "tools/${binary}.sha256"
44+
45+
mv "tools/${binary}" tools/goss
3746
chmod +rx tools/goss
3847
- name: Install dgoss
3948
shell: bash
4049
run: |
41-
curl -fsSL https://github.com/goss-org/goss/releases/${{ inputs.version }}/download/dgoss -o tools/dgoss
50+
release_url="https://github.com/goss-org/goss/releases/${{ inputs.version }}/download"
51+
52+
curl -fsSL "${release_url}/dgoss" -o tools/dgoss
53+
54+
curl -fsSL "${release_url}/dgoss.sha256" -o tools/dgoss.sha256
55+
(cd tools && sha256sum -c dgoss.sha256)
56+
rm -f tools/dgoss.sha256
57+
4258
chmod +rx tools/dgoss

setup-hadolint/action.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,19 @@ runs:
3737
arch="arm64"
3838
fi
3939
40-
curl -fsSL https://github.com/hadolint/hadolint/releases/${{ inputs.version }}/download/hadolint-linux-${arch} -o ${{ inputs.base_path }}/tools/hadolint
41-
chmod +rx ${{ inputs.base_path }}/tools/hadolint
40+
release_url="https://github.com/hadolint/hadolint/releases/${{ inputs.version }}/download"
41+
dest="${{ inputs.base_path }}/tools"
42+
43+
# v2.13.0+ uses lowercase "linux"; older releases use "Linux"
44+
binary="hadolint-linux-${arch}"
45+
if ! curl -fsSL "${release_url}/${binary}" -o "${dest}/${binary}" 2>/dev/null; then
46+
binary="hadolint-Linux-${arch}"
47+
curl -fsSL "${release_url}/${binary}" -o "${dest}/${binary}"
48+
fi
49+
50+
curl -fsSL "${release_url}/${binary}.sha256" -o "${dest}/${binary}.sha256"
51+
(cd "${dest}" && sha256sum -c "${binary}.sha256")
52+
rm -f "${dest}/${binary}.sha256"
53+
54+
mv "${dest}/${binary}" "${dest}/hadolint"
55+
chmod +rx "${dest}/hadolint"

0 commit comments

Comments
 (0)