Phase 2 Improvements: Array safety, URL encoding, and source guards
IMPROVEMENTS: 1. Array Safety (reference-db.sh:128-134) - Changed from unsafe word-splitting to proper array construction - Uses while loop with IFS= read for safer user enumeration - Prevents issues with usernames containing special characters 2. URL Encoding for Domain Checks (reference-db.sh:24-48) - Added url_encode() helper function - Encodes domain names for curl requests - Handles domains with special characters safely - Prevents curl errors on unusual domain names 3. Configurable Timeout (reference-db.sh:21) - Made domain check timeout configurable via DOMAIN_CHECK_TIMEOUT env var - Default remains 3 seconds - Allows users to adjust for slow networks/servers 4. Source Guards (all library files) - Added source guard pattern to prevent re-sourcing - Added to: reference-db.sh, common-functions.sh, system-detect.sh - Prevents variable/function duplication if file is sourced twice Testing: All syntax checks pass, functionality verified
This commit is contained in:
@@ -5,6 +5,12 @@
|
||||
# Shared utilities for all Server Management Toolkit modules
|
||||
#############################################################################
|
||||
|
||||
# Source guard - prevent re-sourcing
|
||||
if [ -n "${_COMMON_FUNCTIONS_LOADED:-}" ]; then
|
||||
return 0
|
||||
fi
|
||||
readonly _COMMON_FUNCTIONS_LOADED=1
|
||||
|
||||
#############################################################################
|
||||
# Professional Color Scheme
|
||||
# - Uses ONLY basic ANSI colors (works on ANY terminal)
|
||||
|
||||
Reference in New Issue
Block a user