mirror of
https://github.com/dockur/windows.git
synced 2026-07-05 07:08:10 +01:00
feat: Sanitize environment variables (#1785)
This commit is contained in:
+12
-7
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user