diff --git a/.templates/01-config_yaml.sh b/.templates/01-config_yaml.sh index 409cbaccc..3af0293ec 100644 --- a/.templates/01-config_yaml.sh +++ b/.templates/01-config_yaml.sh @@ -74,7 +74,9 @@ dq_escape() { while IFS= read -r LINE; do [[ -z "$LINE" || "$LINE" != *=* ]] && continue - KEY="${LINE%%=*}" + # Escape special characters not within single quotes + LINE=$(sed -E "s/([^'])([][\$\`\"\\!&;|<>])/\1\\\\\\2/g" <<< "$LINE") + KEY="${LINE%%=*}" VALUE="${LINE#*=}" # !secret handling if [[ "$VALUE" =~ ^!secret[[:space:]]+(.+) ]]; then