aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/forms/validators.py
diff options
context:
space:
mode:
authorDennis Fink2026-10-31 17:49:44 +0100
committerDennis Fink2026-10-31 17:49:44 +0100
commitf7c0691e0da84644ea8b2b83ad5574fe179da59b (patch)
tree6993fb2c0b9e5f973623b616128cc793da8d1b5b /webmentions_ssg/forms/validators.py
parent6924ad7e52033365c55d5afacdd916c502cc80cb (diff)
downloadwebmentions-ssg-f7c0691e0da84644ea8b2b83ad5574fe179da59b.tar.gz
webmentions-ssg-f7c0691e0da84644ea8b2b83ad5574fe179da59b.zip
fix(core): reject IPv6 transition addresses
Harden public-address validation against NAT64, IPv4-compatible, 6to4, and IPv4-mapped IPv6 forms that can encapsulate private or metadata destinations. Apply the same check to literal form validation and DNS-resolved addresses so SSRF protections do not rely on Python's `is_global` behavior alone.
Diffstat (limited to '')
-rw-r--r--webmentions_ssg/forms/validators.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/webmentions_ssg/forms/validators.py b/webmentions_ssg/forms/validators.py
index 36f36ce..c1f1c97 100644
--- a/webmentions_ssg/forms/validators.py
+++ b/webmentions_ssg/forms/validators.py
@@ -11,7 +11,7 @@ from flask import current_app
from wtforms import Field, ValidationError
from wtforms.form import BaseForm
-from ..url_security import AddressResolutionError, is_public_url
+from ..url_security import AddressResolutionError, is_public_address, is_public_url
class URLMaxBytes:
@@ -174,5 +174,5 @@ class PublicIPLiteral:
except ValueError:
return # Named hosts are resolved only during the background fetch.
- if not address.is_global:
+ if not is_public_address(address):
raise ValidationError(field.gettext("URL must use a public address."))