From 477f300c40d6ffaa288d3edeb223f077a0e94440 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Fri, 3 May 2024 16:30:03 +0200 Subject: [PATCH] [backend/federation] Make resolvedActorId / authenticatedUserId mismatch a debug message instead of an exception --- .../ActivityPub/ActivityHandlerService.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityHandlerService.cs b/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityHandlerService.cs index e5bfcf0c..5183c94a 100644 --- a/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityHandlerService.cs +++ b/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityHandlerService.cs @@ -40,11 +40,15 @@ public class ActivityHandlerService( var resolvedActor = await userResolver.ResolveAsync(activity.Actor.Id); if (authenticatedUserId == null) - throw GracefulException - .UnprocessableEntity("Refusing to process activity without authenticatedUserId"); - if (resolvedActor.Id != authenticatedUserId && authenticatedUserId != null) - throw GracefulException - .UnprocessableEntity($"Authenticated user id {authenticatedUserId} doesn't match resolved actor id {resolvedActor.Id}"); + throw GracefulException.UnprocessableEntity("Refusing to process activity without authenticatedUserId"); + + if (resolvedActor.Id != authenticatedUserId) + { + logger.LogDebug("Authenticated user id {authenticatedUserId} doesn't match resolved actor id {resolvedActorId}, skipping", + authenticatedUserId, resolvedActor.Id); + return; + } + if (new Uri(activity.Actor.Id).Host != new Uri(activity.Id).Host) throw GracefulException .UnprocessableEntity($"Activity identifier ({activity.Actor.Id}) host doesn't match actor identifier ({activity.Id}) host");