From 1f6a5b4a446ca3f9f8b3b7e243a343a2ed18dc0e Mon Sep 17 00:00:00 2001 From: abrown38 Date: Tue, 29 Sep 2026 17:12:44 +0000 Subject: [PATCH] validate username in online mode Usernames are used in file names and URLs, so a '/' could write files outside the game directory and a space broke the share links. Only allow a-z, 0-9 and _ (max 32 chars) and re-prompt otherwise. Co-Authored-By: Claude Opus 5.5 --- wordle | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wordle b/wordle index e2003fe..db6ec40 100755 --- a/wordle +++ b/wordle @@ -140,9 +140,15 @@ function set_options() { echo -en "${CLEAR_SCREEN}" declare -g USER - read -r -p "Username: " USER + read -r -p "Username: " USER || exit 1 USER="${USER,,}" + # Username is used in file names and URLs so only allow safe characters + while [[ -z "${USER}" || "${USER}" == *[!a-z0-9_]* || ${#USER} -gt 32 ]]; do + read -r -p "${CLEAR_UP1}Username (letters, numbers and _ only): " USER || exit 1 + USER="${USER,,}" + done + declare -g DAY DAY=$(( EPOCHSECONDS / 86400 ))