Skip to content

Commit 23f3f91

Browse files
committed
Add minisign key check
1 parent 3a7817d commit 23f3f91

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,26 @@ jobs:
195195
fi
196196
197197
mkdir -p out dist
198-
printf '%s' "$MINISIGN_KEY" | base64 -d > out/minisign.key
199-
printf '%s' "$MINISIGN_PUB" | base64 -d > out/minisign.pub
198+
if ! printf '%s' "$MINISIGN_KEY" | base64 -d > out/minisign.key 2>/dev/null; then
199+
echo "MINISIGN_KEY is not valid base64. Re-encode minisign.key and update the secret." >&2
200+
exit 1
201+
fi
202+
if ! printf '%s' "$MINISIGN_PUB" | base64 -d > out/minisign.pub 2>/dev/null; then
203+
echo "MINISIGN_PUB is not valid base64. Re-encode minisign.pub and update the secret." >&2
204+
exit 1
205+
fi
200206
chmod 600 out/minisign.key
201207
cp out/minisign.pub dist/minisign.pub
202208
209+
if ! grep -qi "minisign secret key" out/minisign.key; then
210+
echo "MINISIGN_KEY does not look like a minisign secret key. Check that secrets are not swapped." >&2
211+
exit 1
212+
fi
213+
if ! grep -qi "minisign public key" out/minisign.pub; then
214+
echo "MINISIGN_PUB does not look like a minisign public key. Check that secrets are not swapped." >&2
215+
exit 1
216+
fi
217+
203218
export GNUPGHOME
204219
GNUPGHOME="$(mktemp -d)"
205220
trap 'rm -rf "$GNUPGHOME"' EXIT

0 commit comments

Comments
 (0)