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

Properly catch whether a share is null #15145

Merged
merged 2 commits into from
Mar 24, 2015
Merged

Properly catch whether a share is null #15145

merged 2 commits into from
Mar 24, 2015

Conversation

LukasReschke
Copy link
Member

Despite it's PHPDoc the function might return null which was not properly catched and thus in some situations the share was resolved to the sharing users root directory.

To test this perform the following steps:

  • Share file in owncloud 7 (7.0.4.2)
  • Delete the parent folder of the shared file
  • The share stays is in the DB and the share via the sharelink is inaccessible. (which is good)
  • Upgrade to owncloud 8 (8.0.2) (This step is crucial. The bug is not reproducible without upgrading from 7 to 8)
  • Optional Step: Logout, Reset Browser Session, etc.
  • Access the share via the old share url: almost empty page, but there is a download button which adds a "/download" to the URL.
  • Upon clicking, a download.zip is downloaded which contains EVERYTHING from the owncloud directory (of the user who shared the file)
  • No exception is thrown and no error is logged.

This will add a check whether the share is a valid one and also adds unit tests to prevent further regressions in the future. Needs to be backported to ownCloud 8. Will create a backport once this got reviewed and tested to avoid triple the work.

Adding a proper clean-up of the orphaned shares is out-of-scope and would probably require some kind of FK or so.

Fixes #15097

cc @PVince81 @icewind1991 @karlitschek @DeepDiver1975 Please review and test properly.
cc @jnfrmarks Requires a complete retest of whether the sharing still works properly.

Despite it's PHPDoc the function might return `null` which was not properly catched and thus in some situations the share was resolved to the sharing users root directory.

To test this perform the following steps:

* Share file in owncloud 7 (7.0.4.2)
* Delete the parent folder of the shared file
* The share stays is in the DB and the share via the sharelink is inaccessible. (which is good)
* Upgrade to owncloud 8 (8.0.2) (This step is crucial. The bug is not reproduceable without upgrading from 7 to 8. It seems like the old tokens are handled different than the newer ones)
* Optional Step: Logout, Reset Browser Session, etc.
* Access the share via the old share url: almost empty page, but there is a dowload button which adds a "/download" to the URL.
* Upon clicking, a download.zip is downloaded which contains EVERYTHING from the owncloud directory (of the user who shared the file)
* No exception is thrown and no error is logged.

This will add a check whether the share is a valid one and also adds unit tests to prevent further regressions in the future. Needs to be backported to ownCloud 8.

Adding a proper clean-up of the orphaned shares is out-of-scope and would probably require some kind of FK or so.

Fixes #15097
@icewind1991
Copy link
Contributor

Code looks good 👍

@ghost
Copy link

ghost commented Mar 24, 2015

Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/10777/
Test PASSed.

@scrutinizer-notifier
Copy link

The inspection completed: 2 new issues, 1 updated code elements

@ghost
Copy link

ghost commented Mar 24, 2015

Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/10779/
Test PASSed.

@PVince81
Copy link
Contributor

Proper cleanup would be done here: #14676

@PVince81
Copy link
Contributor

Tested, works 👍

PVince81 pushed a commit that referenced this pull request Mar 24, 2015
Properly catch whether a share is `null`
@PVince81 PVince81 merged commit 302c190 into master Mar 24, 2015
@PVince81 PVince81 deleted the fix-15097-master branch March 24, 2015 12:37
@LukasReschke LukasReschke mentioned this pull request Mar 25, 2015
@MorrisJobke MorrisJobke added this to the 8.1-current milestone Mar 26, 2015
@davitol
Copy link
Contributor

davitol commented Jul 2, 2015

Tested and seems good 👍

@lock lock bot locked as resolved and limited conversation to collaborators Aug 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Data leak using orphaned share-over-link
6 participants