Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow moves #4284

Merged
merged 3 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/disallow-moves-between-shares.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Do not allow moves between shares

We no longer allow moves between shares, even if they resolve to the same space.

https://github.com/cs3org/reva/pull/4284
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,12 @@ func (s *service) Move(ctx context.Context, req *provider.MoveRequest) (*provide
Interface("destination", req.Destination).
Msg("sharesstorageprovider: Got Move request")

if !utils.ResourceIDEqual(req.Source.ResourceId, req.Destination.ResourceId) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implies that Source and Destination are relative references, right? Can't I move them by specific ids only? Wouldn't this fail then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct. The sharesstorageprovider works with references where the storage and space ids are hardcoded values and the opaque id is the encoded resource id of the shared resource (in the form <storageid>:<spaceid>:<opaqueid>. The actual referenced resource is selected by path, so it's always gonna be a relative reference.

return &provider.MoveResponse{
Status: status.NewUnimplemented(ctx, nil, "sharesstorageprovider: can not move between shares"),
}, nil
}

// TODO moving inside a shared tree should just be a forward of the move
// but when do we rename a mounted share? Does that request even hit us?
// - the registry needs to invalidate the alias
Expand Down Expand Up @@ -643,11 +649,6 @@ func (s *service) Move(ctx context.Context, req *provider.MoveRequest) (*provide
Status: rpcStatus,
}, nil
}
if srcReceivedShare.Share.ResourceId.SpaceId != dstReceivedShare.Share.ResourceId.SpaceId {
return &provider.MoveResponse{
Status: status.NewInvalid(ctx, "sharesstorageprovider: can not move between shares on different storages"),
}, nil
}

gatewayClient, err := s.gatewaySelector.Next()
if err != nil {
Expand Down