Enhancement: reimplement "Share with private link"
Like in Google Picasa and many other web services, it is often very useful to a pseudo-secret link to share files with someone.
I suggest to add a further file share possibility to the existing "share with link" method:
- share with hash link
The hash of course salted.
Present shared links look like
- https://example.org/owncloud/public.php?service=files&file=%2FBenutzer%2Ffiles%2Fsmiling.jpg
Suggested is to have links like
- https://example.org/owncloud/public.php?service=files&file=GTx3gEW7yY7oxujQ35t5fbCnAdHNqGaF.jpg
Yes, #100 and #105 are related, but not the same. Both features were actually already there in 4.0.x, but are gone again in 4.5...
Actually this was called "Share with private link"
Sharing with Link should always use a token to identify the parent to the shared file or directory: If I have the following path in my ownCloud files:
/Images/Events/2012/Developer Meeting
and I share the "Developer meeting" folder the link should look like
http://localhost/owncloud/public.php?service=files&token=GTx3gEW7yY7oxujQ35t5fbCnAdHNqGaF&file=/Developer Meeting
This way my folder structure is not exposed. The token should work like a chroot.
We can set a password for the token and even use it to identify contacts. This would allow us to use individual passwords for contacts. The token should even be used for public links to not reveal any other information of my folder structure.
@MTGap what dou you think? I need this and if you think this is ok I'll start implementing it. Just checking that you haven't started anything here or have other plans...
@jancborchardt how does dropbox handle this? do they use a token? do they show the filename in the url?
@butonic Token.
https://www.dropbox.com/sh/fsfkqd4kjflcuj2/Wge9KXDucU
Yeah, previously I cared about the cleartext filename being in the link somewhere, now I don’t even anymore.
Just for the record: When I said the filename should be shown in the link, I never suggested to expose the whole path of a shared file. :)
For security reasons, I rather suggest never to have file- oder directory names in the hash and to construct links like (only the extension is preserved)
- https://example.org/owncloud/public.php?service=files&file=GTx3gEW7yY7oxujQ35t5fbCnAdHNqGaF.jpg
Supporting this,
- current system is a security issue (it disclose the files and directory structure) (and this is an bad thing©)
- in case the file is renamed, the link won't work anymore (and this is an bad thing©)
Right, the file renaming issue is a dealbreaker. Then let’s just fully tokenize it – including the extension, because that also is a security issue when sharing a password-protected file (because others would know it’s an image or text).
@jancborchardt I think the extension must stay intact like in my example
- https://example.org/owncloud/public.php?service=files&file=GTx3gEW7yY7oxujQ35t5fbCnAdHNqGaF.jpg
to allow extension-based clients and servers and operating systems to auto-detect the correct handler for that file (text editor, image viewer, mp3 player ...)
addition:
a subdirectory
- https://example.org/owncloud/public.php?service=files&file=GTx3gEW7yY7oxujQ35t5fbCnAdHNqGaF
an mp3 file in a subdirectory
- https://example.org/owncloud/public.php?service=files&file=GTx3gEW7yY7oxujQ35t5fbCnAdHNqGaF/bYtiKXjnCj9xgDskyKaixREJ8w2nzE9o.mp3
an mp3 file in a subdirectory https://example.org/owncloud/public.php?service=files&file=GTx3gEW7yY7oxujQ35t5fbCnAdHNqGaF/bYtiKXjnCj9xgDskyKaixREJ8w2nzE9o.mp3
That is not how it's supposed to work in my opinion - that way, you're not only leaking the file extension, but also how deep the directory structure is! And you will most probably have the same problems when directories are renamed... the only proper solution in my eyes is to use a single hash value, like this: https://example.org/owncloud/public.php?service=files&file=GTx3gEW7yY7oxujQ35t5fbCnAdHNqGaF no matter in how deep a subdirectory the actual file is. No extension should be necessary - the file type should be sent via mime type header as far as I know; it would have to be tested if every browser and OS is capable of determining the type from that, though.
The hash value is stored in whatever table the share is stored in, mapping to the proper location of the file; and when a directory is moved/renamed while owncloud is watching, this share's location can be simply adapted by changing the table with the mapping!
I don't even think the extension is necessary - that should be sent via mime type header as far as I know; it would have to be determined if every browser and OS is capable of doing so, though.
Yes, I think providing the link with hash but keep the extention seems a bad idea. And every browser is able to deal with with mime types.
We should also remove the "Foo shared the folder Bar with you", I don't see a reason to disclose the owner of the file.
\cc @jancborchardt
Edit: I opened a new issue for this #247
- I think we all agree that using a tokenized url Is needed to handle file renames correctly. ** While a token is only needed when sending links, I can imagine a "notify via email" button for owncloud users that would use a token as well to directly open the shared item when the user is logged in.
- Apart from browsers being responsible to hande mimetype, using file extensions is not necessary, as the current sharing implementation presents an authorized guest an html page with a preview for images and a download button.
** nevertheless using a raw=true parameter like github uses to directly link to a file should be possible. See this image url:
Something like https://example.tld/owncloud/public.php?service=files&t=GTx3gEW7yY7oxujQ35t5fbCnAdHNqGaF?raw=true to be able to directly link to public files - The "Foo shared the folder Bar with you" is a matter of preference of the owncloud administrator. We can move this decision to the theme. It should however be possible to greet e.g. contacts with their name.
@MTGap I have been trying to figure out the best way how to re add tokenized urls to the sharing api. Basically a token is used to lookup the correct row in the oc_share table. Everyting else can then be read from there. I could store the token in the oc_share table by adding a column there and passing a random token to OC_Share::put(). put() does some magic for groups and I haven't had the time to understand generateTarget(). So I'm a little bit reluctant to touch that code. I could then use a token to lookup a share in public.php and load the parameters before using getShareWithByLink ... at least thats the plan. Any insight from you would be helpful. Thx!
ok ... I have a version running for one of our customers. will test more tomorrow and port to core closing some project issues.
@butonic cool - awaiting your pull request ;-)
On Thu, Nov 15, 2012 at 7:03 PM, RandolfCarter [email protected]:
Do I see correctly that there is still the possibility to set a password? Why is that needed? In my opinion it provides no additional security. The token is such that it can't be guessed in reasonable time anyway, and if someone should get hold of the link he or she will by all chances also get the password (since they are distributed in the same email)...
— Reply to this email directly or view it on GitHubhttps://github.com/owncloud/core/issues/105#issuecomment-10418550.
(Did you delete your comment?)
I’d agree that an additional password is not needed. I’d prefer we remove it, but I guess it was a customer request.
I’d agree that an additional password is not needed. I’d prefer we remove it, but I guess it was a customer request.
What are you talking about? We both discussed this for a long time and agreed on it...
The point is that normal users don't understand that it is secured because of the token and it is only security through obscurity.
@jancborchardt wrote "I’d agree that an additional password is not needed. I’d prefer we remove it, but I guess it was a customer request"
In cases where someone revealed the "shared link" (e.g. published that, or used a link shortener like tinyurl), the shared link is not "secret" anymore.
The alternative method to set a password adds a layer of security to any link, wether it is a shared link (hash) or a plain link to a fil.
This is why I like to have both possibilities in ownCloud.
i) shared link (hashed link) ii) optional: a password needed for this file