From 19909bdef06969d332e00db58b2023f9e492bb4c Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Fri, 25 Nov 2022 18:11:31 -0700 Subject: Discard messages from blocked servers --- users/views/activitypub.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'users/views/activitypub.py') 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: -- cgit v1.2.3