aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/net.py
diff options
context:
space:
mode:
authorDennis Fink2026-11-17 14:44:00 +0100
committerDennis Fink2026-11-17 14:44:00 +0100
commit227092b57acc886469e16bcc4c0d3256e86d3d1e (patch)
treec1de8d5f8f3a37562e482f84e8017213c08a05d6 /webmentions_ssg/net.py
parentf98b0e446b41325c494bd97900b7bbf730a7d67e (diff)
downloadwebmentions-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 '')
-rw-r--r--webmentions_ssg/net.py13
1 files changed, 0 insertions, 13 deletions
diff --git a/webmentions_ssg/net.py b/webmentions_ssg/net.py
index b827180..df62ca7 100644
--- a/webmentions_ssg/net.py
+++ b/webmentions_ssg/net.py
@@ -279,19 +279,6 @@ def resolve_public_addresses(
return tuple(str(address) for address in addresses)
-def normalized_hostname(url: str) -> str | None:
- """Return a normalized URL hostname, or None for malformed URLs.
-
- :param url: URL from which to extract a hostname.
- :returns: Normalized hostname, or ``None`` when the URL is invalid or has no host.
- """
- try:
- hostname = urlsplit(url).hostname
- except TypeError, ValueError:
- return None
- return hostname.rstrip(".") if hostname is not None else None
-
-
def media_type_of(headers: Mapping[str, str]) -> str:
"""Return a normalized media type without Content-Type parameters.