aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/config.py
diff options
context:
space:
mode:
authorDennis Fink2026-10-31 17:42:00 +0100
committerDennis Fink2026-10-31 17:42:00 +0100
commit6924ad7e52033365c55d5afacdd916c502cc80cb (patch)
tree8a52b8e8fbae7a6bcc85d250cac2436a2c42e748 /webmentions_ssg/config.py
parent3494eab1208dc18478485e02c61e292556502fa6 (diff)
downloadwebmentions-ssg-6924ad7e52033365c55d5afacdd916c502cc80cb.tar.gz
webmentions-ssg-6924ad7e52033365c55d5afacdd916c502cc80cb.zip
feat(receiver): add resource limits and retention
Bound incoming request and URL sizes so untrusted Webmention submissions cannot consume unbounded application or database resources. Purge old failed and deleted received Webmentions on a schedule, and use portable SHA-256 URL fingerprints to preserve uniqueness for long URLs.
Diffstat (limited to '')
-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 28cea64..97dd682 100644
--- a/webmentions_ssg/config.py
+++ b/webmentions_ssg/config.py
@@ -42,6 +42,13 @@ class DefaultConfig:
# Empty by default: no target hostnames are accepted until configured.
ALLOWED_HOSTNAMES = set()
+ # Cap incoming HTTP request bodies (also applies to other Flask routes).
+ MAX_CONTENT_LENGTH = 64 * 1024
+ # Independent UTF-8 byte limit for each submitted source/target URL.
+ MAX_WEBMENTION_URL_BYTES = 8192
+ # Purge terminal failed/deleted received Webmentions after 30 days.
+ RECEIVED_RETENTION_DAYS = 30
+ RECEIVED_RETENTION_SCHEDULE = "0 3 * * *"
MAX_REDIRECTS = 20
MAX_SOURCE_BYTES = 1_000_000
REQUEST_TIMEOUT = 5.0