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

Check that the owner of a link share still has share permissions on access #20928

Merged
4 commits merged into from
Feb 9, 2016

Conversation

icewind1991
Copy link
Contributor

Part of #19157 (comment)

Easiest way to check atm is to manually edit the permissions in the database for a publicly shared file

cc @PVince81 @DeepDiver1975

@icewind1991 icewind1991 added this to the 9.0-current milestone Dec 3, 2015
@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @LukasReschke, @DeepDiver1975 and @owncloud-bot to be potential reviewers

@PVince81
Copy link
Contributor

PVince81 commented Dec 3, 2015

That's only half the fix, we should also prevent the web UI page to show

@PVince81
Copy link
Contributor

PVince81 commented Dec 3, 2015

AFAIK it already has a check when link sharing is completely disabled. Maybe just add an additional condition there ?

@icewind1991
Copy link
Contributor Author

That's only half the fix

Yes, I'm aware

Maybe just add an additional condition there ?

That place doesn't have an easy way to access the fileinfo/permissions

@PVince81
Copy link
Contributor

PVince81 commented Dec 4, 2015

Never mind, I tested the wrong thing... This is only public dav

@PVince81
Copy link
Contributor

PVince81 commented Dec 4, 2015

I can say that it works, because the web UI is using public webdav and am now getting an error 👍

The next step will be to make the share link page show a 404.


public function beforeMethod(RequestInterface $request, ResponseInterface $response){
// verify that the owner didn't have his share permissions revoked
if (!$this->fileInfo->isShareable()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of a new plugin, how about adding the check in PublicAuth ? Or put it in the code that resolves the share ? (which would cover both Webdav and web UI)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that we need access to the fileinfo which we dont have in the publicauth or share code

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about just adding this if block directly inline then here https://github.com/owncloud/core/pull/20928/files#diff-c176f230a2fba97e6f6e1af689b09e6aR73 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't do that since this check only needs to be done for public stuff

@PVince81
Copy link
Contributor

PVince81 commented Feb 1, 2016

Tested with #20903

  • BUG: Opening a public link folder shows the folder, but with an error message. It would be better to deny the whole link as if it did not exist (404)
  • BUG: Public link with file share (picture) still displays the picture in the page

@PVince81
Copy link
Contributor

PVince81 commented Feb 9, 2016

@icewind1991 any update ? Can this be done before the freeze ?

Are you having difficulties making this work ?

@icewind1991 icewind1991 force-pushed the publicdav-check-permissions branch from 70a01b0 to 94c3dc3 Compare February 9, 2016 12:10
@icewind1991
Copy link
Contributor Author

@PVince81 all fixed

@DeepDiver1975 @MorrisJobke @rullzer please review

@PVince81
Copy link
Contributor

PVince81 commented Feb 9, 2016

Tested, works now 👍
Thanks!

@schiessle
Copy link
Contributor

Code looks good... what about unit tests?

@schiessle
Copy link
Contributor

existing tests seems to fail as well:

OCA\Files_Sharing\Controllers\ShareControllerTest::testShowShare
OCP\Files\NotFoundException: 

/ssd/jenkins/workspace/core-ci-linux/database/sqlite/label/SLAVE/apps/files_sharing/lib/controllers/sharecontroller.php:228
/ssd/jenkins/workspace/core-ci-linux/database/sqlite/label/SLAVE/apps/files_sharing/tests/controller/sharecontroller.php:320

@rullzer
Copy link
Contributor

rullzer commented Feb 9, 2016

Fixed the unit test.. the node needed more to be mocked... Sometimes I think I should mock less...

@icewind1991
Copy link
Contributor Author

Added test

@icewind1991 icewind1991 force-pushed the publicdav-check-permissions branch from d234fe1 to acd8c72 Compare February 9, 2016 14:03
@schiessle
Copy link
Contributor

looks good now... 👍 if all tests passed

ghost pushed a commit that referenced this pull request Feb 9, 2016
Check that the owner of a link share still has share permissions on access
@ghost ghost merged commit f64dbc6 into master Feb 9, 2016
@MorrisJobke MorrisJobke deleted the publicdav-check-permissions branch February 9, 2016 21:14
@lock lock bot locked as resolved and limited conversation to collaborators Aug 7, 2019
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants