fix: verify object and actor exists in Like request. Closes #3223 (#3232)

This commit is contained in:
Gabe Kangas 2023-08-03 20:34:50 -07:00 committed by GitHub
parent c9298def5b
commit e166e009aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,6 +13,14 @@ import (
func handleLikeRequest(c context.Context, activity vocab.ActivityStreamsLike) error { func handleLikeRequest(c context.Context, activity vocab.ActivityStreamsLike) error {
object := activity.GetActivityStreamsObject() object := activity.GetActivityStreamsObject()
actorReference := activity.GetActivityStreamsActor() 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() objectIRI := object.At(0).GetIRI().String()
actorIRI := actorReference.At(0).GetIRI().String() actorIRI := actorReference.At(0).GetIRI().String()