Add username validation
Check that the username is valid before doing any work. Use the default regex from debian's adduser.conf. Will also avoid risk of special characters causing issues.
This commit is contained in:
parent
d88f536536
commit
9714a11204
1 changed files with 5 additions and 0 deletions
5
build.sh
5
build.sh
|
@ -189,6 +189,11 @@ source "${SCRIPT_DIR}/common"
|
|||
# shellcheck source=scripts/dependencies_check
|
||||
source "${SCRIPT_DIR}/dependencies_check"
|
||||
|
||||
#check username is valid
|
||||
if [[ ! "$FIRST_USER_NAME" =~ ^[a-z][-a-z0-9_]*$ ]]; then
|
||||
echo "Invalid FIRST_USER_NAME: $FIRST_USER_NAME"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dependencies_check "${BASE_DIR}/depends"
|
||||
|
||||
|
|
Loading…
Reference in a new issue