test: parse installer download host instead of substring check

Extract the raw_url() template from install.sh and compare the parsed
hostname to raw.githubusercontent.com. Resolves the CodeQL "incomplete
URL substring sanitization" alert on the old substring assertion.
This commit is contained in:
3252a8
2026-06-10 23:09:38 +03:00
parent 86ac925b19
commit 5ca1ecfce6
+5 -1
View File
@@ -1,6 +1,8 @@
import re
import shutil
import subprocess
from pathlib import Path
from urllib.parse import urlsplit
import pytest
@@ -33,7 +35,9 @@ def test_shell_installer_downloads_raw_files_and_runs_import_in_container():
script = INSTALL_SCRIPT.read_text(encoding="utf-8")
assert script.startswith("#!/bin/sh")
assert "raw.githubusercontent.com" in script
raw_url_template = re.search(r"printf '(https://[^']+)' \"\$repo\"", script)
assert raw_url_template is not None
assert urlsplit(raw_url_template.group(1)).hostname == "raw.githubusercontent.com"
assert "git clone" not in script
assert "backend python backend/scripts/import_legacy.py" in script
assert "Optional source Remnashop .env path" in script