diff options
| author | Dennis Fink | 2026-11-17 14:44:00 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-11-17 14:44:00 +0100 |
| commit | 227092b57acc886469e16bcc4c0d3256e86d3d1e (patch) | |
| tree | c1de8d5f8f3a37562e482f84e8017213c08a05d6 /webmentions_ssg/migrations/versions/3e8c87a96b2d_source_domain_rules.py | |
| parent | f98b0e446b41325c494bd97900b7bbf730a7d67e (diff) | |
| download | webmentions-ssg-227092b57acc886469e16bcc4c0d3256e86d3d1e.tar.gz webmentions-ssg-227092b57acc886469e16bcc4c0d3256e86d3d1e.zip | |
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.
Diffstat (limited to 'webmentions_ssg/migrations/versions/3e8c87a96b2d_source_domain_rules.py')
| -rw-r--r-- | webmentions_ssg/migrations/versions/3e8c87a96b2d_source_domain_rules.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/webmentions_ssg/migrations/versions/3e8c87a96b2d_source_domain_rules.py b/webmentions_ssg/migrations/versions/3e8c87a96b2d_source_domain_rules.py new file mode 100644 index 0000000..04f5b8d --- /dev/null +++ b/webmentions_ssg/migrations/versions/3e8c87a96b2d_source_domain_rules.py @@ -0,0 +1,39 @@ +# SPDX-FileCopyrightText: 2026 Dennis Fink <me+coding@dennisfink.me> +# +# SPDX-License-Identifier: BSD-3-Clause + +"""Add persistent source-domain block and allow lists. + +Revision ID: 3e8c87a96b2d +Revises: e62b1a7c4d90 +""" + +import sqlalchemy as sa +from alembic import op + +revision = "3e8c87a96b2d" +down_revision = "e62b1a7c4d90" +branch_labels = None +depends_on = None + + +def upgrade(): + op.create_table( + "blocked_sources", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("domain", sa.Text(), nullable=False), + sa.PrimaryKeyConstraint("id"), + sa.UniqueConstraint("domain"), + ) + op.create_table( + "allowed_sources", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("domain", sa.Text(), nullable=False), + sa.PrimaryKeyConstraint("id"), + sa.UniqueConstraint("domain"), + ) + + +def downgrade(): + op.drop_table("allowed_sources") + op.drop_table("blocked_sources") |
