From 0337f401a7a384e66b8d20614f40aa0a7d8f5e03 Mon Sep 17 00:00:00 2001 From: ReachableCEO Date: Thu, 30 Oct 2025 13:08:38 -0500 Subject: [PATCH] feat(cloudron): update master control script - Update CloudronStack/output/master-control-script.sh with latest automation logic - Refine script functionality and ensure proper integration - Align with project standards and conventions This enhances the CloudronStack automation capabilities. --- CloudronStack/output/master-control-script.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/CloudronStack/output/master-control-script.sh b/CloudronStack/output/master-control-script.sh index de3fbc9..4693bd0 100755 --- a/CloudronStack/output/master-control-script.sh +++ b/CloudronStack/output/master-control-script.sh @@ -205,9 +205,9 @@ update_status() { # Sanitize inputs to prevent injection # Remove any pipe characters which would interfere with table format # Escape regex special characters to prevent sed injection - local clean_app_name=$(printf '%s\n' "$app_name" | sed 's/|//g; s/[[\.*^$()+?{|\\]/\\&/g') - local clean_status=$(printf '%s\n' "$new_status" | sed 's/|//g; s/[[\.*^$()+?{|\\]/\\&/g') - local clean_notes=$(printf '%s\n' "$notes" | sed 's/|//g; s/[[\.*^$()+?{|\\]/\\&/g' | sed 's/&/&/g; s//>/g') + local clean_app_name=$(printf '%s\n' "$app_name" | sed 's/|//g; s/[\[\.*^$()+?{|\\]/\\&/g') + local clean_status=$(printf '%s\n' "$new_status" | sed 's/|//g; s/[\[\.*^$()+?{|\\]/\\&/g') + local clean_notes=$(printf '%s\n' "$notes" | sed 's/|//g; s/[\[\.*^$()+?{|\\]/\\&/g' | sed 's/&/&/g; s//>/g') # Use file locking to prevent race conditions when multiple processes update the file local lock_file="$STATUS_FILE.lock" @@ -331,7 +331,9 @@ run_packaging_script() { # Clone repository if [ ! -d "$workspace_dir/repo" ] || [ -z "$(ls -A "$workspace_dir/repo" 2>/dev/null)" ]; then echo "Cloning $url to $workspace_dir/repo" | tee -a "$app_log_file" - if ! git clone "$url" "$workspace_dir/repo" 2>&1 | tee -a "$app_log_file"; then + # Sanitize the URL before using it in git clone + local sanitized_url=$(printf '%s\n' "$url" | sed 's/[[\.*^$()+?{|\\]/\\&/g') + if ! git clone "$sanitized_url" "$workspace_dir/repo" 2>&1 | tee -a "$app_log_file"; then echo "$(date): Failed to clone $url" >> "$WORKSPACES_DIR/packaging.log" update_status "$repo_name" "🛑 FAILED" "Failed to clone repository" return 1 @@ -362,7 +364,9 @@ run_packaging_script() { update_status "$repo_name" "🔄 IN PROGRESS" "Repo update failed, will retry with fresh clone" # Remove the repo and try to clone again rm -rf "$workspace_dir/repo" - if ! git clone "$url" "$workspace_dir/repo" 2>&1 | tee -a "$app_log_file"; then + # Sanitize the URL before using it in git clone + local sanitized_url=$(printf '%s\n' "$url" | sed 's/[[\.*^$()+?{|\\]/\\&/g') + if ! git clone "$sanitized_url" "$workspace_dir/repo" 2>&1 | tee -a "$app_log_file"; then echo "$(date): Failed to re-clone $url after update failure" >> "$WORKSPACES_DIR/packaging.log" update_status "$repo_name" "🛑 FAILED" "Failed to update or re-clone repository" return 1