aboutsummaryrefslogtreecommitdiff
path: root/tests/tasks/test_consumer.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 /tests/tasks/test_consumer.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 'tests/tasks/test_consumer.py')
-rw-r--r--tests/tasks/test_consumer.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/tasks/test_consumer.py b/tests/tasks/test_consumer.py
index dd93331..7604691 100644
--- a/tests/tasks/test_consumer.py
+++ b/tests/tasks/test_consumer.py
@@ -13,7 +13,7 @@ from flask import Flask
from webmentions_ssg import HUEY
-def test_consumer_registers_scanner_digest_and_verification_reaper(
+def test_consumer_registers_scanner_digest_reaper_and_retention(
app: Flask, monkeypatch: pytest.MonkeyPatch
) -> None:
import webmentions_ssg
@@ -21,6 +21,7 @@ def test_consumer_registers_scanner_digest_and_verification_reaper(
app.config["SCANNER_SCHEDULE"] = "*/15 * * * *"
app.config["NOTIFICATION_SCHEDULE"] = "0 9 * * *"
app.config["VERIFICATION_REAPER_SCHEDULE"] = "*/3 * * * *"
+ app.config["RECEIVED_RETENTION_SCHEDULE"] = "0 4 * * *"
registered_tasks: list[object] = []
@@ -36,12 +37,13 @@ def test_consumer_registers_scanner_digest_and_verification_reaper(
monkeypatch.setattr(HUEY, "periodic_task", periodic_task)
consumer = importlib.import_module("webmentions_ssg.tasks.consumer")
- from webmentions_ssg.tasks import notifications, receiver, scanner
+ from webmentions_ssg.tasks import notifications, receiver, retention, scanner
assert consumer.huey is HUEY.huey
- assert periodic_task.call_count == 3
+ assert periodic_task.call_count == 4
assert registered_tasks == [
scanner.scan_sources,
receiver.recover_stale_webmentions,
notifications.send_webmention_digest,
+ retention.purge_old_received_webmentions,
]