Skip to content

Commit 3f19ce9

Browse files
committed
Verify drone-ssh binary checksum after download
Download checksums.txt from the drone-ssh release alongside the binary and verify it. Protects against tampered or corrupted release artifacts.
1 parent 1530429 commit 3f19ce9

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

entrypoint.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,17 @@ else
6262
log_error "Downloaded file is missing or empty: ${TARGET}" "${ERR_INVALID_BINARY}"
6363
fi
6464

65+
# Download checksum file
66+
if ! curl -fsSL --retry 5 --keepalive-time 2 --location ${INSECURE_OPTION} \
67+
"${DOWNLOAD_URL_PREFIX}/checksums.txt" -o "${GITHUB_ACTION_PATH}/checksums.txt"; then
68+
log_error "Failed to download checksums.txt from ${DOWNLOAD_URL_PREFIX}." "${ERR_DOWNLOAD_FAILED}"
69+
fi
70+
71+
# Verify checksum
72+
if ! (cd "${GITHUB_ACTION_PATH}" && shasum -c checksums.txt --ignore-missing); then
73+
log_error "Checksum verification failed for ${CLIENT_BINARY}." "${ERR_INVALID_BINARY}"
74+
fi
75+
6576
chmod +x "${TARGET}"
6677
fi
6778

0 commit comments

Comments
 (0)