summaryrefslogtreecommitdiffstats
path: root/users
diff options
context:
space:
mode:
authorAndrew Godwin2022-11-25 18:11:31 -0700
committerAndrew Godwin2022-11-25 18:11:31 -0700
commit19909bdef06969d332e00db58b2023f9e492bb4c (patch)
treedeb5ad12141d5b9b00217c268b5edadd2e46ba49 /users
parent8ca36fd95800907a1c7f3c9efedd0085b8f0ec9b (diff)
downloadtakahe-19909bdef06969d332e00db58b2023f9e492bb4c.tar.gz
takahe-19909bdef06969d332e00db58b2023f9e492bb4c.tar.bz2
takahe-19909bdef06969d332e00db58b2023f9e492bb4c.zip
Discard messages from blocked servers
Diffstat (limited to 'users')
-rw-r--r--users/views/activitypub.py7
-rw-r--r--users/views/admin/federation.py2
2 files changed, 8 insertions, 1 deletions
diff --git a/users/views/activitypub.py b/users/views/activitypub.py
index 2c7020a..cca57fb 100644
--- a/users/views/activitypub.py
+++ b/users/views/activitypub.py
@@ -150,6 +150,13 @@ class Inbox(View):
f"Inbox error: cannot fetch actor {document['actor']}"
)
return HttpResponseBadRequest("Cannot retrieve actor")
+ # See if it's from a blocked domain
+ if identity.domain.blocked:
+ # I love to lie! Throw it away!
+ exceptions.capture_message(
+ f"Inbox: Discarded message from {identity.domain}"
+ )
+ return HttpResponse(status=202)
# If there's a "signature" payload, verify against that
if "signature" in document:
try:
diff --git a/users/views/admin/federation.py b/users/views/admin/federation.py
index da8209a..4d6b179 100644
--- a/users/views/admin/federation.py
+++ b/users/views/admin/federation.py
@@ -30,7 +30,7 @@ class FederationEdit(FormView):
class form_class(forms.Form):
blocked = forms.BooleanField(
- help_text="If this domain is blocked from interacting with this server",
+ help_text="If this domain is blocked from interacting with this server.\nAll incoming posts from this domain will be irrecoverably dropped.",
widget=forms.Select(choices=[(True, "Blocked"), (False, "Not Blocked")]),
required=False,
)