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. --- contrib/webmentions-ssg.example.cfg | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'contrib') diff --git a/contrib/webmentions-ssg.example.cfg b/contrib/webmentions-ssg.example.cfg index 2b7b115..45ae297 100644 --- a/contrib/webmentions-ssg.example.cfg +++ b/contrib/webmentions-ssg.example.cfg @@ -48,6 +48,19 @@ LOGFILE_BACKUP_COUNT = 10 # Webmention. Include each hostname you serve; wildcards are not supported. ALLOWED_HOSTNAMES = {"example.com", "www.example.com"} +# Maximum size of an incoming HTTP request body, including form encoding. +# This global Flask limit also applies to login and administration routes. +MAX_CONTENT_LENGTH = 64 * 1024 +# Independent UTF-8 byte limit for each URL submitted to /endpoint. +# Increase cautiously: a longer URL consumes additional storage and network IO. +MAX_WEBMENTION_URL_BYTES = 8192 +# Delete failed/deleted received Webmentions this many days after their most +# recent update; verified, pending, and outgoing records are never purged. +# Deleted status pages return 404; the same pair can be resubmitted afterward. +RECEIVED_RETENTION_DAYS = 30 +# Daily at 03:00 UTC (Huey's default timezone). +RECEIVED_RETENTION_SCHEDULE = "0 3 * * *" + # Defense in depth: restrict the Huey worker service account with outbound # firewall/network-policy rules that block loopback, RFC1918, link-local, ULA, # and cloud metadata ranges, including IPv6. The application also pins -- cgit v1.3.1