test(security): reject URLs with embedded credentials

(cherry picked from commit 09494cb720)
This commit is contained in:
Rishi Gupta authored and safishamsi committed 2026-10-21 19:32:46 +01:00
1 parent 822fbb04c2
commit 2b07311b0d
1 file changed
+9
+9
View File
@@ -75,6 +75,15 @@ def test_validate_url_rejects_invalid_port(url):
validate_url(url)
@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)
# ---------------------------------------------------------------------------