diff options
| author | Sam Tygier <samtygier@yahoo.co.uk> | 2019-01-05 18:20:36 +0000 |
|---|---|---|
| committer | XECDesign <XECDesign@users.noreply.github.com> | 2019-01-22 17:44:28 +1000 |
| commit | 9714a11204f2c937a1c8b7d5c654426ed6c6909b (patch) | |
| tree | 0795b5c90e0ab17dc82485f8fc8d6134f0877a1f /build.sh | |
| parent | d88f536536ca3071edb56e85224fdf1c34086a16 (diff) | |
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.
Diffstat (limited to 'build.sh')
| -rwxr-xr-x | build.sh | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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" |
