[bugfix] disallow following or blocking yoursel (#667)

Closes #664
This commit is contained in:
ugla 2022-06-25 11:14:05 +02:00 committed by GitHub
commit 3e4e57d554
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 157 additions and 0 deletions

View file

@ -65,6 +65,11 @@ func (p *processor) FollowCreate(ctx context.Context, requestingAccount *gtsmode
return p.RelationshipGet(ctx, requestingAccount, form.ID)
}
// check for attempt to follow self
if requestingAccount.ID == targetAcct.ID {
return nil, gtserror.NewErrorNotAcceptable(fmt.Errorf("accountfollowcreate: account %s cannot follow itself", requestingAccount.ID))
}
// make the follow request
newFollowID, err := id.NewRandomULID()
if err != nil {