Skip to content

Commit 39d1453

Browse files
Add a check for all URLs in the package file (#7848)
Avoid issues like #7847 by downloading and checking SHA for each file in the package.json bundle.
1 parent 600c5d7 commit 39d1453

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

.github/workflows/pull-request.yml

+1
Original file line numberDiff line numberDiff line change
@@ -268,3 +268,4 @@ jobs:
268268
run: |
269269
bash ./tests/ci/build_boards.sh
270270
bash ./tests/ci/eboot_test.sh
271+
bash ./tests/ci/pkgrefs_test.sh

tests/ci/eboot_test.sh

100644100755
File mode changed.

tests/ci/pkgrefs_test.sh

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
set -ev
4+
5+
fail=0
6+
for i in $(cat "$TRAVIS_BUILD_DIR/package/package_esp8266com_index.template.json" | jq '.packages[0]."tools" | .[] | .systems[] | "\(.url) \(.checksum)"' | sort -u | sed 's/ /@/'); do
7+
url=$(echo $i | sed 's/@/ /' | cut -f2 -d\" | cut -f1 -d' ')
8+
sha=$(echo $i | sed 's/@/ /' | cut -f2 -d\" | cut -f2 -d' ' | cut -f2 -d:)
9+
echo "INFO: Checking $url"
10+
rm -f file.bin
11+
wget --quiet -O file.bin $url
12+
calc=$(sha256sum file.bin | cut -f1 -d" ")
13+
if [ "$sha" != "$calc" ]; then
14+
echo "ERROR: Download failed or SHA mismatch for $url"
15+
echo "ERROR: Expected $sha"
16+
echo "ERROR: Received $calc"
17+
fail=1
18+
fi
19+
done
20+
21+
if [ $fail -ne 0 ]; then
22+
echo ERROR: Package file integrity check failed
23+
exit 1
24+
fi

0 commit comments

Comments
 (0)