-
Notifications
You must be signed in to change notification settings - Fork 114
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
up and download of file shares #1170
up and download of file shares #1170
Conversation
a72b6f4
to
db8a677
Compare
This scenario is still failing: https://cloud.drone.io/cs3org/reva/2544/5/7
I was hoping that at least that one would be a newly-passing test. I will make those sort of |
The download gets a 404 - not found ??? |
hm the reva logs show 404s but not for a oh wait that is an upload ... and if it is using tus the context is disconnected and we have no logs aaaaarrggg. @labkode @ishank011 we really need to reinitialize the logger for the upload context. See #923 or could we pass a logger / context to all service New() functions so we can attach a logger to the context that is used? |
@phil-davis ok, so the problem with the ocis driver is that the skeleton files are not available and they cannot be easily put sumewhere on disk, because the layout is deconstructed. We'll have to use the cs3 api to upload the skeleton. That is why the test gets a 404 because it cannot share the file. |
is this PR for fixing ocis storage only or does it fixes file sharing for other storages as well ? |
it fixes acessing single share files for all storage drivers. but I don't know why the tests in reva fail and I am still figuring out how to run the testsuite locally... |
The CI currently runs with "owncloud" storage and fails. IMO the skeleton files are correctly "simulated" in that case. https://github.com/owncloud/core/blob/master/tests/acceptance/features/bootstrap/Provisioning.php |
yep, found the readme to run the testsuite locally ... investigating |
I used the debugger to halt the requests ... the shadow_folder really is not populated when accepting the share ... so something is going wrong earlier |
@phil-davis this one seems to have gotten better: https://cloud.drone.io/cs3org/reva/2555/4/7
|
Yes, the local API tests are bug-demo scenarios. We expect that when a bug is fixed, then the bug-demo scenario will fail. The process is:
If we had software that already worked, we would not have to try and track all this :) |
oohohhhhhh and see what we got:
|
fixes owncloud/product#208 |
Those are a real win - they are the genuine happy-path workflow for ordinary share-accept-download. |
that |
@phil-davis did I adjust the tests correctly in b0dfd59 ? |
Yes, looks good. More tests are passing. The preview problem with '500' status is "improved" - anything is better than |
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.
Test changes look good - there is improvement in the test results. So the code must be good ;)
Needs someone to review the actual code. @labkode @ishank011 ?
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.
👍 code looks fine
}, nil | ||
} | ||
// if it is a file allow download | ||
if ri.Type == provider.ResourceType_RESOURCE_TYPE_FILE { |
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.
optional: for the sake of readability, would be nice to have all if
statement lead to error case branching, and the non-branching code path being the success path
@butonic @ishank011 the code can be merged given that this is an optional configuration at the storage provider and is set to false as default. Specially when not all filesystem support it. |
@labkode @ishank011 hm,
or at the gateway storage provider? The code checks if the share node exists and is of type file, otherwise it prevents up or download. so this really only allows up and download for referenced files. I don't see the necessity for a config option. If the storage driver does not alllow creating shares on individual shares ... that is an implementation detail of the driver. And it might differ between multiple storage providers. The gateway should be agnostic about this. |
@butonic The storage driver doesn't control which files can be shared, that is determined by the share provider and so we have no mechanism in place to stop creating shares for single files for any storage drivers. Because of this, we also can't prevent uploads/downloads at the driver level because we don't know where it's coming from. So it'd have to be checked at the gateway storage provider only. |
@ishank011 @labkode I still don't get what you want me to make configurable. https://github.com/cs3org/reva/pull/1170/files#diff-87a927da7f0ac3d45225420a90987c21R154 is for InitiateFileDownload https://github.com/cs3org/reva/pull/1170/files#diff-87a927da7f0ac3d45225420a90987c21R396 if for InitiateFileUpload both are in the gateway storage provider. do you want me to add a new or a now config option to the gateway storage provider? the code changes does not affect the eos driver. shared files will not show up in the Shares folder ... AFAICT the storage driver should return a not implemented error when trying to persist a grant on a file. because only the storage driver knows what it supports. it is also responsible for not showing the sharing / grant permissions when stating or listing files. the gateway needs to send the share request to the storage first. the share manager is only responsible for caching the actually persisted shares. if the storage provider returns a not implemented error, there is nothing for the share manager to cache / store. the code change in this pr is unrelated to that behavior, because the eos driver does not persist file grants. the share does not show up in the shared folder ... if the share manager is responsible for determining if a resource can be shared or not he would have to check with the responsible storage provider, and as a result the driver. sharing or resharing permissions can change at any node in the tree. the single source of truth for that is the storage driver. the manager is only responsible for caching the shares to efficiently answer queries like "shared with me" / "shared with others". the gateway is responsible for updating both: the storage provider and the share manager. they may run out of sync, but it should be possible to repopulate the complete share manager from the storage providers. if not we have a design problem, because we would need to keep the two services in sync, something we were trying to avoid AFAIR. please help me understand the problem. |
b0dfd59
to
b241e12
Compare
@ishank011 btw eos does support acls on files: https://github.com/cern-eos/eos/blob/master/doc/configuration/permission.rst#acls
We could add a flag to the eosdriver to disable setting shares on files... |
@butonic I've been brainstorming with @ishank011 of what could be done on EOS to support ACL on files and is doable, we'll prototype implementation after finishing etag propagation for the shared folder. For filesystems not supporting file-based sharing, we need a capability to be queried for the storage provider to avoid showing the share icon in the WebUI. @butonic rebase, and when is green I'll merge. |
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
b241e12
to
8cb2dc9
Compare
@labkode @ishank011 rebased. Regarding ACLs: CS3 grants != ACLs ... very much so. I realized the following difference when implementing permissions checks for the owncloud driver, which uses extended attributes to store permissions. IIRC we discussed the following scenario at the last workshop:
Or in short: the With ACLs that is not true, because ACLs are propagated down the tree when they are set. This might lead to O(n) writes, where n is the number of children in the tree. Grants work differently. They are only applied to a single node (file or folder). To check the grant permissions all parent nodes of the path need to be checked. This creates O(n) reads / stat calls, where n is the number of path segments. In EOS ACLs work differently yet again: https://github.com/cern-eos/eos/blob/master/doc/configuration/permission.rst Regardless of the storage, an integration with OS level ACLs will always lead to O(n) writes when renaming a shared folder. And for grants we need to implement expiry eg as an extended attribute anyway. For the owncloud and ocis driver we will go with a pure grant implementation, accepting the O(n) reads tradeoff, because reads can be scaled better than writes. We already have an ACL integration with samba and already see the write bottleneck there when renaming folder. So for us ACL integration is only an additional option. I plan to change the extended attribute prefix for shares we use to store this from this acl could also be used to check permissions, which would be a different eos driver that has its own permissions checking ... or you know someone to add it to eos ;-) let me know if we should discuss this in chat. |
@butonic CI |
@butonic apologies for the delay in replying; this slipped out of my radar.
Yes, this should ideally be the case and I was wondering why we don't do that, but the latest EOS actually supports that. I was working with an older version where setting an attribute on a file meant actually setting it on its parent folder, which would lead to huge security risks. So we weren't in the favour of this change without a flag to disable it. But now it looks good to merge. The only issue is that the ACLs are not persisted across versions, which, as @labkode mentioned, we would work on next.
Makes a lot of sense. Maybe we can also discuss about this change in EOS because the reads overhead would definitely be a lot less than that of writes, but I'm pretty sure that there would be some reason behind the fact that we still apply ACLs to all the children; would be good to know what that is. |
But thinking back on this, how often do the writes take place as compared to the reads? A GET or a PROPFIND at the webdav endpoint involves 3-4 stat calls per resource, whereas the writes would occur only when creating new shares or renames. It would be good to run some benchmarks but I think the frequency of read operations makes up quite well for the lower overhead. |
the CI failure seems to come from a difference in the XML output of
vs
reva does not show the empty elements when rendering xml (it does when rendering as json), which is exactly what the testsuite says:
@phil-davis when was this added to the testsuite ... I don't see where my PR would touch related code. I did remove a few expected test failures, ... oh wait ... it is not failing because of those ... it is failing because we actually fixed stuff:
getting rid of those ... |
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
8cb2dc9
to
3653e31
Compare
hm the resharing tests fail again with #1202 ... |
The shared folder logic in the gateway storageprovider was not allowing file up and downloads for single file shares. We now check if the reference is actually a file to determine if up / download should be allowed.
fixes: owncloud/product#205 and as a result likely owncloud/product#229, owncloud/product#208 and probably more.
cc @phil-davis