Skip to content

Commit a730b8b

Browse files
AdamSalehclaude
andcommitted
fix: pin codecov CLI version and verify checksum
Pin the codecov CLI download to a specific version (v11.2.8) and verify the SHA256 checksum before executing, addressing the supply-chain risk of fetching an unpinned "latest" binary. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Adam Saleh <adam@asaleh.net>
1 parent 66f634e commit a730b8b

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

scripts/openshiftci-presubmit-unittests.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,20 @@ make test
3636
echo "Codecov token not found at ${CODECOV_TOKEN_FILE}, skipping upload"
3737
exit 0
3838
fi
39-
curl -OSs --fail-with-body https://cli.codecov.io/latest/linux/codecov
39+
CODECOV_VERSION="v11.2.8"
40+
curl -OSs --fail-with-body "https://keybase.io/codecovsecurity/pgp_keys.asc"
41+
gpg --no-default-keyring --keyring trustedkeys.gpg --import pgp_keys.asc
42+
curl -OSs --fail-with-body "https://cli.codecov.io/${CODECOV_VERSION}/linux/codecov"
43+
curl -OSs --fail-with-body "https://cli.codecov.io/${CODECOV_VERSION}/linux/codecov.SHA256SUM"
44+
curl -OSs --fail-with-body "https://cli.codecov.io/${CODECOV_VERSION}/linux/codecov.SHA256SUM.sig"
45+
if ! gpgv codecov.SHA256SUM.sig codecov.SHA256SUM; then
46+
echo "Codecov CLI GPG signature verification failed, aborting upload"
47+
exit 1
48+
fi
49+
if ! grep 'codecov$' codecov.SHA256SUM | sha256sum --check --status; then
50+
echo "Codecov CLI checksum verification failed, aborting upload"
51+
exit 1
52+
fi
4053
chmod +x codecov
4154
CODECOV_TOKEN="$(cat "${CODECOV_TOKEN_FILE}")" ./codecov upload-process --flag unit-tests --file cover.out
4255
) || echo "Coverage upload to codecov.io failed, continuing"

0 commit comments

Comments
 (0)