From 6924ad7e52033365c55d5afacdd916c502cc80cb Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Sat, 31 Oct 2026 17:42:00 +0100 Subject: 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. --- webmentions_ssg/config.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'webmentions_ssg/config.py') 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 -- cgit v1.3.1