diff options
| author | Dennis Fink | 2026-10-30 20:31:43 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-10-30 20:31:43 +0100 |
| commit | 13a9d9ddce09230017699bc34ac3bf08ed2f84ed (patch) | |
| tree | 3715bd13439a61a8cc6896581811a30b62ac1b16 /tests/forms/test_validators.py | |
| parent | 8c561e702ed15022b17eae81e4185448c021e1cb (diff) | |
| download | webmentions-ssg-13a9d9ddce09230017699bc34ac3bf08ed2f84ed.tar.gz webmentions-ssg-13a9d9ddce09230017699bc34ac3bf08ed2f84ed.zip | |
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.
Diffstat (limited to 'tests/forms/test_validators.py')
| -rw-r--r-- | tests/forms/test_validators.py | 6 |
1 files changed, 6 insertions, 0 deletions
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) |
