Skip to content

fix: allow copy or move on ownerless mounts when no new shares are added - #64869

Open
salmart-dev wants to merge 2 commits into
masterfrom
fix/ownerless-copy-or-move
Open

salmart-dev wants to merge 2 commits into
masterfrom
fix/ownerless-copy-or-move

Conversation

@salmart-dev

@salmart-dev salmart-dev commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Currently, when a user with no sharing permissions tries to move files inside a mount which has also been shared by other users, the move is blocked in all cases. This PR changes this, so that the move or copy is allowed to happen if it would result in the file not being exposed into additional shares than the current ones.

UX Notes:

  1. this makes it possible for a user without share permissions to move files in a location that is not part of a share, but prevents them from moving the file back in the old location, as that would mean sharing the file.
  2. operations that involve link shares are still blocked, as it is not possible to use this logic with those shares: it's not possible to know whether the user has access to that share or not

Technical Note: initially I wanted to use the mounts table for this, but unfortunately in the situation where a mount already exists and the share is a group share (or any share that does not clear the user's mount cache) it results in the fix working only once the full file-system setup is triggered.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Signed-off-by: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com>
This commit allows the move or copy operation inside ownerless mounts,
when the user performing the operation has no sharing permissions and
the operation would not result in exposing the files into additional
shares.

Signed-off-by: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com>
Assisted-by: ClaudeCode:claude-opus-5.5
@salmart-dev salmart-dev added this to the Nextcloud 35.0.2 milestone Sep 28, 2026
@salmart-dev salmart-dev self-assigned this Sep 28, 2026
@salmart-dev salmart-dev added the 3. to review Waiting for reviews label Sep 28, 2026
@salmart-dev
salmart-dev marked this pull request as ready for review September 28, 2026 12:58
@salmart-dev
salmart-dev requested a review from a team as a code owner September 28, 2026 12:58
@salmart-dev
salmart-dev requested review from Altahrim, CarlSchwan, leftybournes and provokateurin and removed request for a team September 28, 2026 12:58
@salmart-dev

Copy link
Copy Markdown
Contributor Author

/backport to stable35

@salmart-dev

Copy link
Copy Markdown
Contributor Author

/backport to stable34

@salmart-dev

Copy link
Copy Markdown
Contributor Author

/backport to stable33

@salmart-dev salmart-dev changed the title Fix/ownerless copy or move fix: allow copy or move on ownerless mounts when no new shares are added Sep 28, 2026
@provokateurin

Copy link
Copy Markdown
Member

this makes it possible for a user without share permissions to move files in a location that is not part of a share, but prevents them from moving the file back in the old location, as that would mean sharing the file.

Not sure about this, it moving a file out of a share should probably also require share permission in this case. Alternatively it should require delete permission on the source node, as moving a file out of a share is effectively deleting it for the share recipients. Not sure which one is the better solution, maybe it should even require both (as does moving a file into a share, since that requires create+share permissions).

@salmart-dev

Copy link
Copy Markdown
Contributor Author

Not sure about this, it moving a file out of a share should probably also require share permission in this case. Alternatively it should require delete permission on the source node, as moving a file out of a share is effectively deleting it for the share recipients. Not sure which one is the better solution, maybe it should even require both (as does moving a file into a share, since that requires create+share permissions).

The logic that I followed is: the user has delete permissions on the storage, so technically they should not be denied deleting or moving a file. However, they lack the sharing permission, so they should not be able to expose data to new shares. In this context, there is nothing saying that the user should not be allowed to move files out of a share, so I would not block it. If this is a use-case we want to support, we should then put it into a feature request.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants