fix(security): reject HTTP URLs without a hostname

This commit is contained in:
Rishi Gupta committed 2026-10-21 22:24:57 +05:30
1 parent 847a93f3ca
commit 6f4782affa
1 file changed
+3
+3
View File
@@ -116,6 +116,9 @@ def validate_url(url: str) -> str:
)
hostname = parsed.hostname
if not hostname:
raise ValueError(f"Blocked URL without a hostname. Got: {url!r}")
if hostname:
# Block known cloud metadata hostnames
if hostname.lower() in _BLOCKED_HOSTS: