Skip to content

Commit

Permalink
Deny Users invite themselves to their own federated connection
Browse files Browse the repository at this point in the history
  • Loading branch information
2403905 committed Feb 14, 2025
1 parent 2a7145a commit 5a747f9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-ocm-invite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Deny Users invite themselves to their own federated connection

Deny Users invite themselves to their own federated connection

https://github.com/cs3org/reva/pull/5077
7 changes: 7 additions & 0 deletions internal/grpc/services/ocminvitemanager/ocminvitemanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package ocminvitemanager

import (
"context"
"fmt"

Check failure on line 23 in internal/grpc/services/ocminvitemanager/ocminvitemanager.go

View workflow job for this annotation

GitHub Actions / lint

"fmt" imported and not used) (typecheck)

Check failure on line 23 in internal/grpc/services/ocminvitemanager/ocminvitemanager.go

View workflow job for this annotation

GitHub Actions / lint

"fmt" imported and not used (typecheck)
"time"

gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
Expand Down Expand Up @@ -170,6 +171,12 @@ func (s *service) ForwardInvite(ctx context.Context, req *invitepb.ForwardInvite
return nil, err
}

if req.GetOriginSystemProvider().Domain == s.conf.ProviderDomain {
return &invitepb.ForwardInviteResponse{
Status: status.NewInvalid(ctx, "can not accept an invite from the same instance"),
}, nil
}

// Accept the invitation on the remote OCM provider
remoteUser, err := s.ocmClient.InviteAccepted(ctx, ocmEndpoint, &client.InviteAcceptedRequest{
Token: req.InviteToken.GetToken(),
Expand Down

0 comments on commit 5a747f9

Please sign in to comment.