aboutsummaryrefslogtreecommitdiff
path: root/tests/test_auth.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/test_auth.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_auth.py b/tests/test_auth.py
index 27e8fb0..2a3d517 100644
--- a/tests/test_auth.py
+++ b/tests/test_auth.py
@@ -161,3 +161,13 @@ def test_password_change_invalidates_existing_session(app: Flask) -> None:
)
def test_is_safe_next_url(next_url: str, expected: bool) -> None:
assert is_safe_next_url(next_url) is expected
+
+
+def test_safe_next_url_fails_closed_when_url_parser_rejects_path(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ def invalid_url(_: str) -> object:
+ raise ValueError("Malformed URL")
+
+ monkeypatch.setattr(auth, "urlsplit", invalid_url)
+ assert is_safe_next_url("/local/path") is False