-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Improve share_folder checks in rmdir #36170
Conversation
Codecov Report
@@ Coverage Diff @@
## master #36170 +/- ##
=======================================
Coverage 54.01% 54.01%
=======================================
Files 63 63
Lines 7404 7404
Branches 1309 1309
=======================================
Hits 3999 3999
Misses 3019 3019
Partials 386 386
Continue to review full report at Codecov.
|
Improve share_folder checks in rmdir
762e04e
to
b644d3d
Compare
@jvillafanez ready for review again |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
if ($path !== '') { | ||
$shareFolder = \trim($this->config->getSystemValue('share_folder', '/'), '/'); | ||
$trimmedPath = \trim($path, '/'); | ||
if ((\strpos("$shareFolder/", "$trimmedPath/") === 0)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems the condition we want is $shareFolder === $trimmedPath
, anything I'm missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If share_folder
is /Company/Stuff/ReceivedShares
and path is /Company
or /Company/Stuff
then those parent folders of ReceivedShares
are also not allowed to be deleted.
See the unit test data provider test cases.
Steps to reproduce
|
Works as expected with the desktop sync client 2.6.0 RC1, macOS 10.14.6. User cannot delete the folder. But the client doesn't restore the deleted folder https://github.com/owncloud/client/issues/7496 |
Hi, is this the fix for CVE-2020-36251? thanks in advance! |
Description
The folder being deleted is only part of the path to
share_folder
if its path matches at the start ofshare_folder
and has the complete matching folder name (i.e. whenshare_folder
is/abc/def
then it is OK tormdir
/abc/de
)Make it so with trim and putting slashes and strpos.
The code here also fixes what is in PR #36168
Related Issue
How Has This Been Tested?
Local unit test runs, and trying combinations of folder deletes in the webUI.
Types of changes
Checklist: