aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/config.py
diff options
context:
space:
mode:
authorDennis Fink2026-10-29 19:49:44 +0100
committerDennis Fink2026-10-29 19:49:44 +0100
commit9a1e863079b64883beadaba7b283621f1b3cf70a (patch)
tree3737edbe481460b13dad9e12eaeb3ed5208dda1b /webmentions_ssg/config.py
parent38f5a47ed79fac6b5cdb525e50168beb67c4a0b3 (diff)
downloadwebmentions-ssg-9a1e863079b64883beadaba7b283621f1b3cf70a.tar.gz
webmentions-ssg-9a1e863079b64883beadaba7b283621f1b3cf70a.zip
fix(receiver): rate limit Webmention submissions
Protect the public endpoint from abusive request floods and repeated duplicate submissions that would otherwise trigger unnecessary verification work. Add per-client and global limits, require shared limiter storage in production, and only reverify existing Webmentions after a configurable cooldown.
Diffstat (limited to 'webmentions_ssg/config.py')
-rw-r--r--webmentions_ssg/config.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/webmentions_ssg/config.py b/webmentions_ssg/config.py
index 6cadbab..aea201b 100644
--- a/webmentions_ssg/config.py
+++ b/webmentions_ssg/config.py
@@ -34,6 +34,13 @@ class DefaultConfig:
MAIL_PASSWORD = None
MAIL_DEFAULT_SENDER = None
+ RATELIMIT_STORAGE_URI = "memory://"
+ RATELIMIT_HEADERS_ENABLED = True
+
+ ENDPOINT_RATE_LIMIT = "10/minute;100/hour"
+ ENDPOINT_GLOBAL_RATE_LIMIT = "1000/hour"
+ ENDPOINT_REVERIFY_COOLDOWN_SECONDS = 600
+
class DevelopmentConfig(DefaultConfig):
DEBUG = True