Fix #287 - Verify the version syntax in *.sh to avoid command injection

This commit is contained in:
William Desportes
2023-08-03 16:14:42 +02:00
parent 6517adbfe3
commit 272944cc5a
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ join() {
echo "${out#$sep}"
}
latest="$(curl -fsSL 'https://www.phpmyadmin.net/home_page/version.json' | jq -r '.version')"
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,}$')"
for variant in apache fpm fpm-alpine; do
commit="$(dirCommit "$variant")"
+1 -1
View File
@@ -88,7 +88,7 @@ command -v jq >/dev/null 2>&1 || { echo >&2 "'jq' is required but not found. Abo
# Create variants
printf '%s\n' "{}" > versions.json
latest="$(curl -fsSL "https://www.phpmyadmin.net/home_page/version.json" | jq -r '.version')"
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,}$')"
sha256="$(curl -fsSL "$(download_url "$latest").sha256" | cut -f1 -d ' ' | tr -cd 'a-f0-9' | cut -c 1-64)"
for variant in "${variants[@]}"; do