diff options
| author | Dennis Fink | 2026-10-31 17:42:00 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-10-31 17:42:00 +0100 |
| commit | 6924ad7e52033365c55d5afacdd916c502cc80cb (patch) | |
| tree | 8a52b8e8fbae7a6bcc85d250cac2436a2c42e748 /webmentions_ssg/tasks/consumer.py | |
| parent | 3494eab1208dc18478485e02c61e292556502fa6 (diff) | |
| download | webmentions-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 'webmentions_ssg/tasks/consumer.py')
| -rw-r--r-- | webmentions_ssg/tasks/consumer.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/webmentions_ssg/tasks/consumer.py b/webmentions_ssg/tasks/consumer.py index afae6e0..fb1d46d 100644 --- a/webmentions_ssg/tasks/consumer.py +++ b/webmentions_ssg/tasks/consumer.py @@ -21,7 +21,7 @@ def create_consumer() -> Huey: """ app = create_app() - from . import notifications, receiver, scanner, sender # noqa: F401 + from . import notifications, receiver, retention, scanner, sender # noqa: F401 schedule = crontab(*app.config["SCANNER_SCHEDULE"].split(), strict=True) HUEY.periodic_task(schedule)(scanner.scan_sources) @@ -36,6 +36,11 @@ def create_consumer() -> Huey: ) HUEY.periodic_task(notification_schedule)(notifications.send_webmention_digest) + retention_schedule = crontab( + *app.config["RECEIVED_RETENTION_SCHEDULE"].split(), strict=True + ) + HUEY.periodic_task(retention_schedule)(retention.purge_old_received_webmentions) + return HUEY.huey |
