test(security): cover malformed URL ports

(cherry picked from commit 57d6217281)
This commit is contained in:
Rishi Gupta authored and safishamsi committed 2026-10-21 19:32:19 +01:00
1 parent 53bfe14613
commit 52dea94b01
1 file changed
+10
+10
View File
@@ -65,6 +65,16 @@ def test_validate_url_rejects_missing_hostname(url):
validate_url(url)
@pytest.mark.parametrize("url", [
"http://example.com:abc/path",
"https://example.com:65536/path",
"http://example.com:0/path",
])
def test_validate_url_rejects_invalid_port(url):
with pytest.raises(ValueError, match="port"):
validate_url(url)
# ---------------------------------------------------------------------------
# safe_fetch - scheme and redirect guards (mocked network)
# ---------------------------------------------------------------------------