summaryrefslogtreecommitdiff
path: root/internal/processing
diff options
context:
space:
mode:
Diffstat (limited to 'internal/processing')
-rw-r--r--internal/processing/account/createblock.go5
-rw-r--r--internal/processing/account/createfollow.go5
2 files changed, 10 insertions, 0 deletions
diff --git a/internal/processing/account/createblock.go b/internal/processing/account/createblock.go
index e1bad0d38..dfe1475cb 100644
--- a/internal/processing/account/createblock.go
+++ b/internal/processing/account/createblock.go
@@ -46,6 +46,11 @@ func (p *processor) BlockCreate(ctx context.Context, requestingAccount *gtsmodel
return p.RelationshipGet(ctx, requestingAccount, targetAccountID)
}
+ // don't block yourself, silly
+ if requestingAccount.ID == targetAccountID {
+ return nil, gtserror.NewErrorNotAcceptable(fmt.Errorf("BlockCreate: account %s cannot block itself", requestingAccount.ID))
+ }
+
// make the block
block := &gtsmodel.Block{}
newBlockID, err := id.NewULID()
diff --git a/internal/processing/account/createfollow.go b/internal/processing/account/createfollow.go
index cd2dcbd8c..49430b9fb 100644
--- a/internal/processing/account/createfollow.go
+++ b/internal/processing/account/createfollow.go
@@ -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 {