summaryrefslogtreecommitdiffstats
path: root/users/views/activitypub.py
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/views/activitypub.py
parent8ca36fd95800907a1c7f3c9efedd0085b8f0ec9b (diff)
downloadtakahe-19909bdef06969d332e00db58b2023f9e492bb4c.tar.gz
takahe-19909bdef06969d332e00db58b2023f9e492bb4c.tar.bz2
takahe-19909bdef06969d332e00db58b2023f9e492bb4c.zip
Discard messages from blocked servers
Diffstat (limited to 'users/views/activitypub.py')
-rw-r--r--users/views/activitypub.py7
1 files changed, 7 insertions, 0 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: