build: fail if any step of signing v2 firmwares fails
What changed, and why it matters
This commit hardens the firmware signing script used when releasing Blockstream Jade hardware wallet firmware. It adds `set -e` so the script stops immediately if any command fails, and explicitly checks that the public and private key files exist before proceeding. Without these changes, the script could silently continue past errors (for example, if a key file was missing or a signing command failed), potentially producing or releasing firmware that was not properly signed. Proper signing is important because users rely on firmware signatures to verify that the software running on their device is authentic and has not been tampered with.
Treat this as a defensive hardening improvement. Review the entire release signing pipeline for similar missing error handling, ensure key files are stored securely and accessed only in controlled release environments, and verify that CI/release logs surface any script failures rather than silently producing artifacts.
Security signals we found
Missing error handling in release signing pipeline
Potential for unsigned or partially signed firmware artifacts
Release-time supply-chain / code-signing hardening
Fail-fast added via set -e and explicit key-file existence checks
Evidence from the diff
The change modifies release/scripts/v2sign.sh, a release-time bash script for signing v2 firmware. It adds set -e at the top so the script exits on any unchecked failure, and two file-existence checks ([ -f ${PUBKEY} ] || false and [ -f ${KEY} ] || false) before changing into the working directory. Previously, missing key files or failed signing steps could be ignored because bash defaults to continuing execution. The script also uses pushd without set -e, and the new guards ensure the release process fails fast rather than producing an incomplete or unsigned artifact.
Changed components
release/scripts/v2sign.shInspect captured patch +5 / −0
diff --git a/release/scripts/v2sign.sh b/release/scripts/v2sign.sh
index 83bc9c0..59bc3b0 100755
--- a/release/scripts/v2sign.sh
+++ b/release/scripts/v2sign.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+set -e
+
if [ -z "${1}" -o -z "${2}" ]
then
echo "Usage: ${0} <version/dir> <key_label>"
@@ -26,6 +28,9 @@ VERIFY_OPTS="-pubin -inkey ${PUBKEY} -pkeyopt digest:sha256 -pkeyopt rsa_padding
pushd "${WORKING_DIR}"
+[ -f ${PUBKEY} ] || false # Public key file must exist
+[ -f ${KEY} ] || false # Private key file must exist
+
# Verify bootloaders are same
sha1=$(sha256sum "${BLEDIR}/bootloader/bootloader.bin" | cut -d\ -f1)
sha2=$(sha256sum "${NORADIODIR}/bootloader/bootloader.bin" | cut -d\ -f1)
Why this scored 34/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.