diff options
| author | Dennis Fink | 2026-08-10 19:36:49 +0200 |
|---|---|---|
| committer | Dennis Fink | 2026-08-10 19:36:49 +0200 |
| commit | 8350bef3e3baea6042ed3780a054cc65707e9f8d (patch) | |
| tree | 81ab5f102045f53d23f89e22a41b2f6a2eef9b52 /webmentions_ssg/forms/__init__.py | |
| parent | afcdb411882a6c157c3b5008e1c633d3e40cd984 (diff) | |
| download | webmentions-ssg-8350bef3e3baea6042ed3780a054cc65707e9f8d.tar.gz webmentions-ssg-8350bef3e3baea6042ed3780a054cc65707e9f8d.zip | |
fix(receiver): prevent requests to non-public addresses
Resolve source hostnames before fetching and reject addresses that are
not globally routable to prevent SSRF against local or private services.
Repeat the check for every HTTP request so redirects cannot bypass the
initial source validation. Treat DNS resolution failures during
verification as temporary fetch errors.
Diffstat (limited to 'webmentions_ssg/forms/__init__.py')
| -rw-r--r-- | webmentions_ssg/forms/__init__.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/webmentions_ssg/forms/__init__.py b/webmentions_ssg/forms/__init__.py index 98962ad..0c54999 100644 --- a/webmentions_ssg/forms/__init__.py +++ b/webmentions_ssg/forms/__init__.py @@ -4,7 +4,7 @@ from flask_wtf import FlaskForm from wtforms import PasswordField, StringField, SubmitField from wtforms.validators import URL, InputRequired, Regexp -from .validators import AllowedHostname, NotEqualTo +from .validators import AllowedHostname, NotEqualTo, PublicURL class LoginForm(FlaskForm): @@ -25,6 +25,7 @@ class EndpointForm(FlaskForm): message="source must begin with http or https", ), NotEqualTo("target"), + PublicURL(), ], ) target = StringField( |
