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

Fix mountpoint copy part 137 #4802

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
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
Loading