From e166e009aaa97b91510871580ae38a924432dd3a Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Thu, 3 Aug 2023 20:34:50 -0700 Subject: [PATCH] fix: verify object and actor exists in Like request. Closes #3223 (#3232) --- activitypub/inbox/like.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/activitypub/inbox/like.go b/activitypub/inbox/like.go index d457de19d..4028d3d30 100644 --- a/activitypub/inbox/like.go +++ b/activitypub/inbox/like.go @@ -13,6 +13,14 @@ import ( func handleLikeRequest(c context.Context, activity vocab.ActivityStreamsLike) error { object := activity.GetActivityStreamsObject() actorReference := activity.GetActivityStreamsActor() + if object.Len() < 1 { + return errors.New("like activity is missing object") + } + + if actorReference.Len() < 1 { + return errors.New("like activity is missing actor") + } + objectIRI := object.At(0).GetIRI().String() actorIRI := actorReference.At(0).GetIRI().String()