Skip to content

Commit 272944c

Browse files
committed
Fix #287 - Verify the version syntax in *.sh to avoid command injection
1 parent 6517adb commit 272944c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

generate-stackbrew-library.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ join() {
6363
echo "${out#$sep}"
6464
}
6565

66-
latest="$(curl -fsSL 'https://www.phpmyadmin.net/home_page/version.json' | jq -r '.version')"
66+
latest="$(curl -fsSL 'https://www.phpmyadmin.net/home_page/version.json' | jq -r '.version' | grep -E '^[0-9]{1,}.[0-9]{1,}.[0-9]{1,}$')"
6767

6868
for variant in apache fpm fpm-alpine; do
6969
commit="$(dirCommit "$variant")"

update.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ command -v jq >/dev/null 2>&1 || { echo >&2 "'jq' is required but not found. Abo
8888
# Create variants
8989
printf '%s\n' "{}" > versions.json
9090

91-
latest="$(curl -fsSL "https://www.phpmyadmin.net/home_page/version.json" | jq -r '.version')"
91+
latest="$(curl -fsSL 'https://www.phpmyadmin.net/home_page/version.json' | jq -r '.version' | grep -E '^[0-9]{1,}.[0-9]{1,}.[0-9]{1,}$')"
9292
sha256="$(curl -fsSL "$(download_url "$latest").sha256" | cut -f1 -d ' ' | tr -cd 'a-f0-9' | cut -c 1-64)"
9393

9494
for variant in "${variants[@]}"; do

0 commit comments

Comments
 (0)