From da86233cad22b0de6eb5d9a0b33ef7697cc0d7b352057e27bbfc3092fd2d013d Mon Sep 17 00:00:00 2001 From: "Marc S. Weidner" Date: Sat, 31 May 2025 08:45:58 +0200 Subject: [PATCH] V8.02.644.2025.05.31 Signed-off-by: Marc S. Weidner --- lib/lib_sanitizer.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/lib_sanitizer.sh b/lib/lib_sanitizer.sh index 116d01e..e07a127 100644 --- a/lib/lib_sanitizer.sh +++ b/lib/lib_sanitizer.sh @@ -35,22 +35,23 @@ arg_check() { sanitize_arg() { declare input="$1" # Define allowed characters: - # letters, digits, dot, underscore, slash, equals, [, ], colon, double-quote, hyphen, space. - declare allowed='a-zA-Z0-9._/=\[\]:"\- ' + # letters, digits, dot, underscore, slash, equals, [, ], colon, double-quote, hyphen, plus, space. + declare allowed declare disallowed - disallowed=$(printf '%s' "${input}" | tr -d "${allowed}") + allowed='a-zA-Z0-9._/=[]:"-+ ' + disallowed=$(printf '%s' "$input" | sed "s/[$allowed]//g") if [[ -n ${disallowed} ]]; then { printf "❌ Invalid character : '%s'. \n" "${disallowed//?/& }" printf "❌ in argument : '%s'. \n" "${input}" - printf "❌ Allowed Characters : 'a-z A-Z 0-9 . _ / = [ ] : \" - ' \n" + printf "❌ Allowed Characters : 'a-z A-Z 0-9 . _ / = [ ] : \" - + space' \n" printf "\n" } >> "${LOG_ERROR}" boot_screen_cleaner printf "\e[91m❌ Invalid character : '%s'. \e[0m\n" "${disallowed//?/& }" >&2 printf "\e[91m❌ in argument : '%s'. \e[0m\n" "${input}" >&2 - printf "\e[91m❌ Allowed Characters : 'a-z A-Z 0-9 . _ / = [ ] : \" - ' \e[0m\n" >&2 + printf "\e[91m❌ Allowed Characters : 'a-z A-Z 0-9 . _ / = [ ] : \" - + space' \e[0m\n" >&2 # shellcheck disable=SC2162 read -p $'\e[92m✅ Press \'ENTER\' to exit the script ... \e[0m' exit "${ERR_INVLD_CHAR}"