From 13a9d9ddce09230017699bc34ac3bf08ed2f84ed Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Fri, 30 Oct 2026 20:31:43 +0100 Subject: fix(core): prevent DNS rebinding in HTTP requests Pin outbound connections to validated public IP addresses so DNS changes cannot redirect receiver or sender requests onto private or link-local networks. Apply the same protection across redirects, add an overall request deadline, and keep DNS resolution out of synchronous endpoint form validation. --- tests/forms/test_validators.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/forms/test_validators.py') diff --git a/tests/forms/test_validators.py b/tests/forms/test_validators.py index 6e26039..2858b4c 100644 --- a/tests/forms/test_validators.py +++ b/tests/forms/test_validators.py @@ -112,3 +112,9 @@ def test_public_url_uses_custom_message(monkeypatch: pytest.MonkeyPatch) -> None with pytest.raises(ValidationError, match="Public URL required"): PublicURL("Public URL required")(form, form.url) + + +def test_allowed_hostname_handles_invalid_ipv6(app: Flask) -> None: + form = URLForm(MultiDict({"url": "http://[::1"})) + with app.app_context(), pytest.raises(ValidationError, match="Invalid input"): + AllowedHostname()(form, form.url) -- cgit v1.3.1