Skip to content

Commit e124453

Browse files
antitreeclaude
andcommitted
fix: verify chainctl checksum after download and pin pip dependency
Add SHA256 checksum verification for the chainctl binary download using the published chainctl_checksums.txt file. Pin keyrings-chainguard-libraries to version 0.2.0 to prevent supply chain attacks via unpinned dependency. Fixes: FIND-007, FIND-043 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2cddd35 commit e124453

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

action.yaml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,27 @@ runs:
125125
else
126126
curl -o ./${out} -fsL --retry 5 --retry-delay 1 --retry-all-errors "${url}"
127127
fi
128+
129+
# Verify chainctl binary checksum
130+
checksums_url="https://dl.${{ inputs.environment }}/chainctl/latest/chainctl_checksums.txt"
131+
echo "Downloading checksums from ${checksums_url}"
132+
curl -o checksums.txt -fsL --retry 3 --retry-delay 1 "${checksums_url}"
133+
expected=$(grep "chainctl_${os}_${arch}" checksums.txt | awk '{print $1}')
134+
if [[ -z "${expected}" ]]; then
135+
echo "::error::No checksum found for chainctl_${os}_${arch} in checksums.txt"
136+
exit 1
137+
fi
138+
if command -v sha256sum &>/dev/null; then
139+
actual=$(sha256sum ./${out} | awk '{print $1}')
140+
else
141+
actual=$(shasum -a 256 ./${out} | awk '{print $1}')
142+
fi
143+
if [[ "${expected}" != "${actual}" ]]; then
144+
echo "::error::Checksum mismatch for chainctl: expected ${expected}, got ${actual}"
145+
exit 1
146+
fi
147+
echo "Checksum verified for chainctl_${os}_${arch}"
148+
128149
chmod +x ./${out}
129150
echo "$(pwd)" >> $GITHUB_PATH
130151
@@ -211,4 +232,4 @@ runs:
211232
name: Install Python keyring package
212233
shell: bash
213234
run: |
214-
python -m pip install "keyrings-chainguard-libraries"
235+
python -m pip install "keyrings-chainguard-libraries==0.2.0"

0 commit comments

Comments
 (0)