From 227092b57acc886469e16bcc4c0d3256e86d3d1e Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Tue, 17 Nov 2026 14:44:00 +0100 Subject: feat(receiver): add source domain access rules Add persistent source block and allow lists with authenticated management, single-row and bulk blocking actions, and optional fail-closed allowlist mode. Reject disallowed sources before enqueueing and recheck policy in verification workers, while sharing canonical hostname normalization across receiver, sender, and configuration paths. --- webmentions_ssg/models.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'webmentions_ssg/models.py') diff --git a/webmentions_ssg/models.py b/webmentions_ssg/models.py index 2b375dd..2304788 100644 --- a/webmentions_ssg/models.py +++ b/webmentions_ssg/models.py @@ -101,6 +101,24 @@ class User(UserMixin, Base): return check_password_hash(self.password_hash, password) +class BlockedSource(Base): + """A source domain denied before verification or outbound fetching.""" + + __tablename__ = "blocked_sources" + + id: Mapped[int] = mapped_column(primary_key=True) + domain: Mapped[str] = mapped_column(Text(), nullable=False, unique=True) + + +class AllowedSource(Base): + """A source domain accepted when allowlist mode is enabled.""" + + __tablename__ = "allowed_sources" + + id: Mapped[int] = mapped_column(primary_key=True) + domain: Mapped[str] = mapped_column(Text(), nullable=False, unique=True) + + class ReceivedWebmention(Base): """Represent a Webmention received for verification.""" -- cgit v1.3.1