Skip to content

Commit

Permalink
Fix #287 - Verify the version syntax in *.sh to avoid command injection
Browse files Browse the repository at this point in the history
  • Loading branch information
williamdes committed Aug 3, 2023
1 parent 6517adb commit 272944c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion generate-stackbrew-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")"
Expand Down
2 changes: 1 addition & 1 deletion update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 272944c

Please sign in to comment.