From 6d2baa7300136b1753f001fce18b727816dacaf8 Mon Sep 17 00:00:00 2001 From: aki Date: Sat, 26 Apr 2025 01:20:15 +0800 Subject: [PATCH] fix(update-setup): Enhance password hash verification in Authelia account management --- update-setup.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/update-setup.sh b/update-setup.sh index 010585e..15fa6d5 100644 --- a/update-setup.sh +++ b/update-setup.sh @@ -494,6 +494,17 @@ EOL fi fi + # Strip the "Digest: " prefix if present + password_hash=$(echo "$password_hash" | sed 's/^Digest: //') + + # Verify hash format + if [[ ! "$password_hash" =~ ^\$argon2id.*$ ]]; then + echo -e "${RED}Error: Generated hash does not have the expected format. Actual value:${NC}" + echo -e "${YELLOW}$password_hash${NC}" + echo -e "${RED}Skipping user creation.${NC}" + continue + fi + echo -e "${GREEN}Password hash generated successfully.${NC}" # Check if user already exists in the file and update