allow @ in parameters and sanitize all parameters using base.set

This commit is contained in:
m8in
2026-05-20 23:55:46 +02:00
parent bd76357b1d
commit c83fa7eae2
6 changed files with 35 additions and 20 deletions
+7 -2
View File
@@ -1,8 +1,11 @@
#!/bin/bash
source /cis/core/base.module.sh
#WARNING: Used for core functionality in setup.sh
# DO NOT rename the script and test changes well!
function prepareFolder() {
local _HOME_FOLDER _SSH_FOLDER _USER
_SSH_FOLDER="${1:?"prepareFolder(): Missing parameter SSH_PATH"}"
@@ -133,9 +136,11 @@ function defineAuthorizedKeysOfUser() {
}
# sanitizes all parameters
base.set DEFINITIONS "${1}" '^[-a-zA-Z0-9/:@._]*$' || exit 1
base.set USER "${2}" '^[-a-zA-Z0-9/:@._]*$' || exit 1
defineAuthorizedKeysOfUser \
"$(echo ${1} | sed -E 's|[^a-zA-Z0-9/:@._-]*||g')" \
"$(echo ${2} | sed -E 's|[^a-zA-Z0-9/:@._-]*||g')" \
"${DEFINITIONS:?"Missing DEFINITIONS"}" \
"${USER:?"Missing USER"}" \
&& exit 0
exit 1