File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -145,17 +145,19 @@ jobs:
145145
146146 # ./ansible/deploy-api-to-jumpbox.sh "$DB_HOST" "$DB_USER" "$DB_PASS" "$DB_NAME" "$JUMP_HOST" "$JUMP_USER"
147147
148+
148149 - name : 🧩 Run Script Deploy API to Jumpbox
149150 run : |
150151 chmod +x ./ansible/deploy-api-to-jumpbox.sh
151152
152- # Get clean DB_HOST (add additional sanitization)
153- DB_HOST=$(terraform -chdir=infra output -raw mysql_fqdn | sed 's/[^ a-zA-Z0-9.-]//g' )
154- echo "DB_HOST='$DB_HOST'" # Verify output
153+ # Get clean DB_HOST - NEW IMPROVED VERSION
154+ DB_HOST=$(terraform -chdir=infra output -raw mysql_fqdn | grep -E '^[ a-zA-Z0-9.-]+$' | head -n1 )
155+ echo "DB_HOST='$DB_HOST'"
155156
156- # Verify this matches exactly: softdefault-mysql-westus2.mysql.database.azure.com
157+ # Strict validation
157158 if [[ ! "$DB_HOST" =~ ^[a-zA-Z0-9.-]+$ ]]; then
158- echo "ERROR: Invalid DB_HOST format"
159+ echo "ERROR: Invalid DB_HOST format: '$DB_HOST'"
160+ echo "Expected format: hostname.domain.tld"
159161 exit 1
160162 fi
161163
@@ -166,7 +168,8 @@ jobs:
166168 JUMP_HOST=$(terraform -chdir=infra output -raw control_node_public_ip | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}')
167169 JUMP_USER=$(terraform -chdir=infra output -raw ssh_user | head -n1 | tr -d '\r\n')
168170
169- ./ansible/deploy-api-to-jumpbox.sh "$DB_HOST" "$DB_USER" "$DB_PASS" "$DB_NAME" "$JUMP_HOST" "$JUMP_USER"
171+ ./ansible/deploy-api-to-jumpbox.sh "$DB_HOST" "$DB_USER" "$DB_PASS" "$DB_NAME" "$JUMP_HOST" "$JUMP_USER"
172+
170173
171174 - name : 🛢️ Run Script Deploy Database
172175 run : |
You can’t perform that action at this time.
0 commit comments