From 569476b993204129d858b0df43926f100fa45dce Mon Sep 17 00:00:00 2001 From: Agent Zero Date: Fri, 31 Jul 2026 21:57:04 +0200 Subject: [PATCH] =?UTF-8?q?gate2:=20fix=20prestart.sh=20shell=20quote=20co?= =?UTF-8?q?nflict=20=E2=80=94=20use=20temp=20Python=20file=20instead=20of?= =?UTF-8?q?=20python3=20-c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prestart.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/prestart.sh b/prestart.sh index e070375..1cca4bb 100644 --- a/prestart.sh +++ b/prestart.sh @@ -31,7 +31,7 @@ echo "[prestart] DB migrations completed successfully." # Migration 0070 creates these roles without passwords; we set them here so the # API/Worker/Auth connections can authenticate. echo "[prestart] Setting DB role passwords..." -python3 -c " +cat > /tmp/set_role_passwords.py << 'PYEOF' import asyncio import os import re @@ -43,7 +43,6 @@ async def set_passwords(): if not db_url: print('[prestart] WARNING: No DB URL for password setup') return - # Extract password from the DB URL (postgresql+asyncpg://user:pass@host:port/db) match = re.search(r'://([^:]+):([^@]+)@', db_url) if not match: print('[prestart] WARNING: Could not extract password from DB URL') @@ -55,9 +54,7 @@ async def set_passwords(): async with engine.begin() as conn: for role in roles: try: - # ALTER ROLE doesn't support prepared statement parameters - # so we inline the password (extracted from DB URL, safe) - await conn.execute(text("ALTER ROLE " + role + " WITH LOGIN PASSWORD '" + pwd + "'")) + await conn.execute(text(f"ALTER ROLE {role} WITH LOGIN PASSWORD '{pwd}'")) print(f'[prestart] Password set for {role}') except Exception as e: print(f'[prestart] WARNING: Could not set password for {role}: {e}') @@ -68,7 +65,9 @@ async def set_passwords(): await engine.dispose() asyncio.run(set_passwords()) -" +PYEOF +python3 /tmp/set_role_passwords.py +rm -f /tmp/set_role_passwords.py # Set crm_runtime password if RUNTIME_DB_PASSWORD is set (legacy support) if [ -n "$RUNTIME_DB_PASSWORD" ]; then