feat: Sanitize environment variables (#1785)

This commit is contained in:
Kroese
2026-07-03 16:25:39 +02:00
committed by GitHub
parent fc8c850b6d
commit 700b3b0902
2 changed files with 13 additions and 7 deletions
+12 -7
View File
@@ -16,17 +16,22 @@ set -Eeuo pipefail
: "${USERNAME:=""}"
: "${PASSWORD:=""}"
# Sanitize variables
KEY=$(strip "$KEY")
WIDTH=$(strip "$WIDTH")
HEIGHT=$(strip "$HEIGHT")
REGION=$(strip "$REGION")
EDITION=$(strip "$EDITION")
KEYBOARD=$(strip "$KEYBOARD")
LANGUAGE=$(strip "$LANGUAGE")
USERNAME=$(strip "$USERNAME")
PASSWORD=$(strip "$PASSWORD")
MIRRORS=4
parseVersion() {
if [[ "${VERSION}" == \"*\" || "${VERSION}" == \'*\' ]]; then
VERSION="${VERSION:1:-1}"
fi
VERSION="${VERSION#"${VERSION%%[! ]*}"}"
VERSION="${VERSION%"${VERSION##*[! ]}"}"
VERSION=$(strip "$VERSION")
[ -z "$VERSION" ] && VERSION="win11"
case "${VERSION,,}" in
+1
View File
@@ -168,6 +168,7 @@ graceful_shutdown() {
local term_grace=3 # seconds before loop ends to send SIGTERM
local cleanup_grace=3 # seconds reserved after the loop for cleanup
TIMEOUT=$(strip "$TIMEOUT")
if [[ ! "$TIMEOUT" =~ ^[0-9]+$ ]]; then
TIMEOUT=115
fi