From d36fa802d87abcb54a80324148f5cfd35b465335 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Tue, 29 Oct 2024 15:10:40 +0100 Subject: [PATCH] [backend/federation] Add extra guard clauses to ActivityHandlerService This should be caught by InboxValidationMiddleware, but more checks are always a good idea. --- .../Core/Federation/ActivityPub/ActivityHandlerService.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityHandlerService.cs b/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityHandlerService.cs index 506b0dfc..a392fec1 100644 --- a/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityHandlerService.cs +++ b/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityHandlerService.cs @@ -52,6 +52,9 @@ public class ActivityHandlerService( return; } + if (resolvedActor.IsLocalUser) + throw GracefulException.UnprocessableEntity("Refusing to process activity for local user"); + if (new Uri(activity.Actor.Id).Host != new Uri(activity.Id).Host) throw GracefulException .UnprocessableEntity($"Activity identifier ({activity.Id}) host doesn't match actor identifier ({activity.Actor.Id}) host");