fix(acls): allow uploading files with read+create+delete permissions#4500
Merged
Conversation
Signed-off-by: Kent Delante <[email protected]>
provokateurin
approved these changes
Mar 11, 2026
Member
Author
|
/backport to stable33 |
Member
Author
|
/backport to stable32 |
Contributor
|
Hello, I'm also tackling the same issue and encountered this pull request as a result. I would like to ask whether it would be more proper to verify whether the file's xxh128 hash match as well from the security perspective? Something like: --- a/apps/groupfolders/lib/ACL/ACLStorageWrapper.php
+++ b/apps/groupfolders/lib/ACL/ACLStorageWrapper.php
@@ -70,13 +70,15 @@
}
public function rename(string $source, string $target): bool {
- if (str_starts_with($source, $target)) {
- $part = substr($source, strlen($target));
- //This is a rename of the transfer file to the original file
- if (str_starts_with($part, '.ocTransferId')) {
+ //This is a rename of the transfer file to the original file
+ if (dirname($source) === dirname($target) && ($ocTransferIdPos = strpos(basename($source), '.ocTransferId')) > 0) {
+ $sourceHash = substr(basename($source), 0, $ocTransferIdPos);
+ $expectedHash = hash('xxh128', basename($target));
+ if ($sourceHash === $expectedHash) {
return $this->checkPermissions($target, Constants::PERMISSION_CREATE) && parent::rename($source, $target);
}
}
+
$permissions = $this->file_exists($target) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE;
$sourceParent = dirname($source);
if ($sourceParent === '.') {Thanks for the fix, BTW. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes an issue with accounts unable to upload files or folders without the edit permission. The logic was essentially copied from server's permission mask wrapper.