Skip to content

Commit

Permalink
feat(ocdav): block mountpoint copy also in spaces case
Browse files Browse the repository at this point in the history
Signed-off-by: jkoberg <jkoberg@owncloud.com>
  • Loading branch information
kobergj committed Aug 8, 2024
1 parent 1bb14ea commit 42fc17b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/unreleased/block-overwriting-mountpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Bugfix: Block overwriting mountpoints

This blocks overwriting mountpoints through the webdav COPY api. It is now returning a bad request when attempting to overwrite a mountpoint.

https://github.com/cs3org/reva/pull/4802
https://github.com/cs3org/reva/pull/4796
https://github.com/cs3org/reva/pull/4786
https://github.com/cs3org/reva/pull/4785
9 changes: 8 additions & 1 deletion internal/http/services/owncloud/ocdav/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,14 @@ func (s *svc) prepareCopy(ctx context.Context, w http.ResponseWriter, r *http.Re

// we must not allow to override mountpoints - so we check if we have access to the parent. If not this is a mountpoint
if destInShareJail {
dir, file := filepath.Split(dstRef.GetPath())
res, err := client.GetPath(ctx, &provider.GetPathRequest{ResourceId: dstStatRes.GetInfo().GetId()})
if err != nil || res.GetStatus().GetCode() != rpc.Code_CODE_OK {
log.Error().Err(err).Msg("error sending grpc get path request")
w.WriteHeader(http.StatusInternalServerError)
return nil
}

dir, file := filepath.Split(filepath.Clean(res.GetPath()))
if dir == "/" || dir == "" || file == "" {
log.Error().Msg("must not overwrite mount points")
w.WriteHeader(http.StatusBadRequest)
Expand Down

0 comments on commit 42fc17b

Please sign in to comment.