test(security): cover hostless HTTP URLs

(cherry picked from commit fad73d94d9)
This commit is contained in:
Rishi Gupta authored and safishamsi committed 2026-10-21 19:32:11 +01:00
1 parent 724a184bdd
commit 8f6ad0f61e
1 file changed
+10
+10
View File
@@ -54,6 +54,16 @@ def test_validate_url_rejects_empty_scheme():
with pytest.raises(ValueError):
validate_url("//no-scheme.example.com")
@pytest.mark.parametrize("url", [
"http://",
"https://",
"http:///etc/passwd",
"https:///example.com/path",
])
def test_validate_url_rejects_missing_hostname(url):
with pytest.raises(ValueError, match="without a hostname"):
validate_url(url)
# ---------------------------------------------------------------------------
# safe_fetch - scheme and redirect guards (mocked network)