Skip to content

Commit 61592ec

Browse files
authored
Merge pull request #1257 from Nordix/fix/sops_action_update
Add checksum verification for SOPS in actions.yml
2 parents b98e2b0 + c5da74e commit 61592ec

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

actions/sops/action.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,21 @@ runs:
5252
SOPS_TARGET_FILE="sops-${VERSION}.${ARCH}.exe"
5353
fi
5454
55+
SOPS_CHECKSUMS_FILE="sops-$VERSION.checksums.txt"
5556
SOPS_DOWNLOAD_URL="https://github.com/getsops/sops/releases/download/${VERSION}/"
5657
echo "Downloading sops from $SOPS_DOWNLOAD_URL/$SOPS_TARGET_FILE"
58+
5759
curl -fsSL -o "$DL_DIR/$SOPS_TARGET_FILE" "$SOPS_DOWNLOAD_URL/$SOPS_TARGET_FILE"
60+
curl -fsSL -o "$DL_DIR/$SOPS_CHECKSUMS_FILE" "$SOPS_DOWNLOAD_URL/$SOPS_CHECKSUMS_FILE"
61+
62+
echo "Verifying checksum"
63+
sum=$(openssl sha1 -sha256 "$DL_DIR/$SOPS_TARGET_FILE" | awk '{print $2}')
64+
65+
expected_sum=$(grep "$SOPS_TARGET_FILE" "$DL_DIR/$SOPS_CHECKSUMS_FILE" | awk '{print $1}')
66+
if [ "$sum" != "$expected_sum" ]; then
67+
echo "SHA sum of $SOPS_TARGET_FILE does not match. Aborting."
68+
exit 1
69+
fi
5870
5971
echo "Installing sops to ${SOPS_TOOL_DIR}"
6072
mkdir -p "$SOPS_TOOL_DIR"

0 commit comments

Comments
 (0)