Skip to content

Commit a6c13bb

Browse files
Potential fix for code scanning alert no. 3: Incomplete URL substring sanitization
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent f1e1d2e commit a6c13bb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/github_installer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ def parse_github_url(url: str) -> Tuple[str, str]:
5858

5959
# Handle full URL
6060
parsed = urlparse(url)
61-
if parsed.hostname and "github.com" in parsed.hostname:
61+
hostname = (parsed.hostname or "").lower()
62+
# Accept only github.com or its subdomains (e.g., gist.github.com), not arbitrary hosts
63+
if hostname == "github.com" or hostname.endswith(".github.com"):
6264
parts = parsed.path.strip("/").split("/")
6365
if len(parts) >= 2:
6466
owner = parts[0]

0 commit comments

Comments
 (0)