Nested sharing could only lower the access rights
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
Mostly I wonder is it a bug or feature? Is there any special reason Nextcloud work like that? And are there any changes in next releases?
Steps to reproduce
- Create folder1 and test.txt in it;
- Give some user read-only permissions to folder;
- Give the same user write prmissions to test.txt;
Expected behaviour
User should be able to write into file. The closest sharing option should be selected.
Actual behaviour
User has read-only access to file.
Cause
In Cache.php of files_sharing application there is an entry:
if (isset($entry['permissions'])) {
$entry['permissions'] &= $sharePermissions;
} else {
$entry['permissions'] = $sharePermissions;
}
If you change AND (&=) to OR (|=), you'll not be able to forbid user something inside the shared folder.
Is there any reason why we can't use $entry['permissions'] to the file?
Nextcloud version: 16
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Cache.php in the files_sharing application and trace how permissions from nested shares are combined. Reproduce the folder and file sharing steps, then establish whether the closest share should grant write access without allowing nested restrictions to be bypassed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- authorization, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100