Skip to content

Commit 363cbc1

Browse files
authored
Add UID sanitization in development environment script
Sanitize UID input to ensure it contains only digits.
1 parent e8e1dd9 commit 363cbc1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drupal/rootfs/etc/s6-overlay/scripts/development-environment.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ if [[ -z "${UID}" ]]; then
1111
exit 0
1212
fi
1313

14+
# ensure no new lines or other non-digits
15+
UID=$(echo "${UID}" | tr -cd '0-9')
16+
1417
# Get the current user for this UID (if any) - don't fail if not found
1518
EXISTING_USER=$(getent passwd "${UID}" 2>/dev/null | cut -d: -f1 || true)
1619

0 commit comments

Comments
 (0)