From 3496b3882ca08e74c108d5abe417eccec5ed4f48 Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Fri, 13 Nov 2026 08:39:18 +0100 Subject: fix(core): reject all Unicode control characters Use shared Unicode category validation so passwords reject C1 controls in addition to C0 and DEL, and reuse the same helper for URL validation. --- webmentions_ssg/forms.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'webmentions_ssg/forms.py') diff --git a/webmentions_ssg/forms.py b/webmentions_ssg/forms.py index 0d83327..005bd20 100644 --- a/webmentions_ssg/forms.py +++ b/webmentions_ssg/forms.py @@ -5,7 +5,6 @@ """Webmention forms and URL validation.""" import ipaddress -import unicodedata from urllib.parse import urlsplit import httpx @@ -16,6 +15,7 @@ from wtforms.form import BaseForm from wtforms.validators import InputRequired, StopValidation from .net import is_public_address +from .validation import is_control_character class URLMaxBytes: @@ -57,7 +57,7 @@ class HTTPURL: raise StopValidation(field.gettext("Invalid URL.")) if any( - character.isspace() or unicodedata.category(character) == "Cc" + character.isspace() or is_control_character(character) for character in value ): raise StopValidation(field.gettext("Invalid URL.")) -- cgit v1.3.1