diff options
| author | Dennis Fink | 2026-10-30 08:35:46 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-10-30 08:41:42 +0100 |
| commit | 4485aeb573ceb37237ea1fbc80665ed6c4136116 (patch) | |
| tree | bce18a2c7fadd657d9f9809ebbc65d06c6cc4dc4 /webmentions_ssg/forms | |
| parent | 9f093cf07a3531ee4b7d02c20151e21c141a93de (diff) | |
| download | webmentions-ssg-4485aeb573ceb37237ea1fbc80665ed6c4136116.tar.gz webmentions-ssg-4485aeb573ceb37237ea1fbc80665ed6c4136116.zip | |
fix(core): harden application configuration
Fail production startup when required configuration is missing,
normalize allowed hostnames before validation, and move shared request
limits into the default configuration so production does not depend on
testing-only values.
Set secure session cookie defaults while preserving explicit overrides
and document the new rate-limit and notification settings in the example
config.
Diffstat (limited to 'webmentions_ssg/forms')
| -rw-r--r-- | webmentions_ssg/forms/validators.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/webmentions_ssg/forms/validators.py b/webmentions_ssg/forms/validators.py index 67ab9c0..dd0ee9b 100644 --- a/webmentions_ssg/forms/validators.py +++ b/webmentions_ssg/forms/validators.py @@ -85,7 +85,8 @@ class AllowedHostname: :param field: Field containing the URL to validate. :raises ValidationError: If the URL hostname is not configured as allowed. """ - if urlsplit(field.data).hostname in current_app.config["ALLOWED_HOSTNAMES"]: + hostname = urlsplit(field.data).hostname + if hostname is not None and hostname in current_app.config["ALLOWED_HOSTNAMES"]: return raise ValidationError(self.message or field.gettext("Invalid input.")) |
