diff --git a/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityHandlerService.cs b/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityHandlerService.cs index 5183c94a..21ac81e6 100644 --- a/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityHandlerService.cs +++ b/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityHandlerService.cs @@ -184,7 +184,10 @@ public class ActivityHandlerService( throw GracefulException.UnprocessableEntity($"Object id '{obj.Id}' not a valid follow request id"); var ids = obj.Id[prefix.Length..].TrimEnd('/').Split("/"); - if (ids.Length != 2 || ids[1] != actor.Id) + if (ids.Length < 2) + throw GracefulException + .UnprocessableEntity("Failed to parse ASAccept activity: ASFollow id doesn't have enough components"); + if (ids[1] != actor.Id) throw GracefulException .UnprocessableEntity($"Actor id '{actor.Id}' doesn't match followee id '{ids[1]}'"); diff --git a/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityRenderer.cs b/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityRenderer.cs index 4e94a7b3..53641abe 100644 --- a/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityRenderer.cs +++ b/Iceshrimp.Backend/Core/Federation/ActivityPub/ActivityRenderer.cs @@ -179,7 +179,7 @@ public class ActivityRenderer( [SuppressMessage("ReSharper", "SuggestBaseTypeForParameter", Justification = "This only makes sense for users")] private string RenderFollowId(User follower, User followee) => - $"https://{config.Value.WebDomain}/follows/{follower.Id}/{followee.Id}"; + $"https://{config.Value.WebDomain}/follows/{follower.Id}/{followee.Id}/{Guid.NewGuid().ToStringLower()}"; public static ASAnnounce RenderAnnounce( ASNote note, ASActor actor, List to, List cc, string uri diff --git a/Iceshrimp.Backend/Core/Federation/ActivityPub/ObjectResolver.cs b/Iceshrimp.Backend/Core/Federation/ActivityPub/ObjectResolver.cs index d150b343..5d4caec7 100644 --- a/Iceshrimp.Backend/Core/Federation/ActivityPub/ObjectResolver.cs +++ b/Iceshrimp.Backend/Core/Federation/ActivityPub/ObjectResolver.cs @@ -49,6 +49,8 @@ public class ObjectResolver( return new ASNote { Id = baseObj.Id, VerifiedFetch = true }; if (baseObj.Id.StartsWith($"https://{config.Value.WebDomain}/users/")) return new ASActor { Id = baseObj.Id }; + if (baseObj.Id.StartsWith($"https://{config.Value.WebDomain}/follows/")) + return new ASFollow { Id = baseObj.Id }; if (await federationCtrl.ShouldBlockAsync(baseObj.Id)) {