summaryrefslogtreecommitdiffstats
path: root/users
diff options
context:
space:
mode:
authorMichael Manfre2022-12-06 00:23:35 -0500
committerGitHub2022-12-05 22:23:35 -0700
commit42c7b629cf68957dab815fe5da4accf484e2cb90 (patch)
treea42f6a44fd20b9e4a7d61d6fd5415d07af298dec /users
parentb8460b0acd3e833b9ec302d9fa3fb6ab28032c0e (diff)
downloadtakahe-42c7b629cf68957dab815fe5da4accf484e2cb90.tar.gz
takahe-42c7b629cf68957dab815fe5da4accf484e2cb90.tar.bz2
takahe-42c7b629cf68957dab815fe5da4accf484e2cb90.zip
Ignore actor delete messages for unknown actors (#124)
Diffstat (limited to 'users')
-rw-r--r--users/views/activitypub.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/users/views/activitypub.py b/users/views/activitypub.py
index b155b08..93a6eae 100644
--- a/users/views/activitypub.py
+++ b/users/views/activitypub.py
@@ -145,9 +145,21 @@ class Inbox(View):
# This ensures that the signature used for the headers matches the actor
# described in the payload.
identity = Identity.by_actor_uri(document["actor"], create=True, transient=True)
+ if (
+ document["type"] == "Delete"
+ and document["actor"] == document["object"]
+ and not identity.pk
+ ):
+ # We don't have an Identity record for the user. No-op
+ exceptions.capture_message(
+ f"Inbox: Discarded delete message for unknown actor {document['actor']}"
+ )
+ return HttpResponse(status=202)
+
if not identity.public_key:
# See if we can fetch it right now
async_to_sync(identity.fetch_actor)()
+
if not identity.public_key:
exceptions.capture_message(
f"Inbox error: cannot fetch actor {document['actor']}"
@@ -160,6 +172,7 @@ class Inbox(View):
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: