test(security): reject URLs with embedded credentials

This commit is contained in:
Rishi Gupta committed 2026-10-21 22:28:48 +05:30
1 parent 2fac78e8ed
commit 09494cb720
1 file changed
+9
+9
View File
@@ -55,6 +55,15 @@ def test_validate_url_rejects_empty_scheme():
validate_url("//no-scheme.example.com")
@pytest.mark.parametrize("url", [
"https://user:secret@example.com/path",
"https://user@example.com/path",
])
def test_validate_url_rejects_embedded_credentials(url):
with pytest.raises(ValueError, match="embedded credentials"):
validate_url(url)
# ---------------------------------------------------------------------------
# safe_fetch - scheme and redirect guards (mocked network)
# ---------------------------------------------------------------------------