-
Notifications
You must be signed in to change notification settings - Fork 113
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
ocdav: skip space lookup on spaces propfind #2977
ocdav: skip space lookup on spaces propfind #2977
Conversation
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes. |
This pull request introduces 3 alerts when merging b6f7a4f into f7b1b5f - view on LGTM.com new alerts:
|
This pull request introduces 3 alerts when merging f23e075 into f7b1b5f - view on LGTM.com new alerts:
|
This pull request introduces 3 alerts when merging 5be2321 into dffcaf7 - view on LGTM.com new alerts:
|
c32a25d
to
ea1a285
Compare
5d106bc
to
6d6beee
Compare
m := res.Status.Message | ||
if res.Status.Code == rpc.Code_CODE_PERMISSION_DENIED { | ||
// check if user has access to resource | ||
sRes, err := client.Stat(ctx, &provider.StatRequest{Ref: &provider.Reference{ResourceId: ref.GetResourceId()}}) |
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.
What is the difference between this stat and the original one above?
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.
The original stat might return an error, to check if we need to hide that error this stat checks if we are allowed to stat the space (well only the resource id, ignoring any path). If this stat returns OK we have read access and can return other errors like PrecondtitionFailed when an etag does not match.
The more I think about it, the more I think we should move 'hiding the existence of spaces' int the storage drivers. an id based lookup has to find the space first. if a user has no access to it we can always return 404 and stop any further request processing.
But that is a task for a separate PR.
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.
But we already received a "Permission Denied" at this point so this reads like the user doesn't have access.
Otherwise the "Permission Denied" error is used incorrectly?
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.
I have to admit this is really confusing. The testsuite does not even cover all requests and we actually need to do this error code handling for every request type...
I'll move this to the driver. That will also allow eos to return 403 forbidden and decomposedfs to return 404 not found. And we can even configure this kind of hiding per space.
m := res.Status.Message | ||
if res.Status.Code == rpc.Code_CODE_PERMISSION_DENIED { | ||
// check if user has access to resource | ||
sRes, err := client.Stat(ctx, &provider.StatRequest{Ref: &provider.Reference{ResourceId: ref.GetResourceId()}}) |
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.
But we already received a "Permission Denied" at this point so this reads like the user doesn't have access.
Otherwise the "Permission Denied" error is used incorrectly?
internal/http/services/owncloud/ocdav/spacelookup/spacelookup.go
Outdated
Show resolved
Hide resolved
b21ce72
to
a40f558
Compare
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]>
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]>
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]>
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]>
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]>
a40f558
to
0d040c3
Compare
* ocdav: skip space lookup on spaces propfind Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * add changelog Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * update unit test Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * lint Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * reduce stat requests Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * update propfind unit tests Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * fix moq propfind comparison in propfind tests Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * lint Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * error handling and response codes Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * remove commented code Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * typos, mimic oc10 not found error message Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * add fieldmask to ListContainer and Stat Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * mimic oc10 not found error message Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * mimic oc10 not found error message in more places Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * fix oc:permissions Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * fix test compile Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * fix nc tests Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * lint Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * small cleanup Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * decomposedfs: add space if fieldmask is empty, * or has 'space' Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * fix propfind root resource path Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * update tests & changelog Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * storageprovidercache: use stringbuffer to build statKey Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * comment cleanup Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
* ocdav: skip space lookup on spaces propfind Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * add changelog Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * update unit test Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * lint Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * reduce stat requests Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * update propfind unit tests Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * fix moq propfind comparison in propfind tests Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * lint Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * error handling and response codes Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * remove commented code Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * typos, mimic oc10 not found error message Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * add fieldmask to ListContainer and Stat Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * mimic oc10 not found error message Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * mimic oc10 not found error message in more places Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * fix oc:permissions Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * fix test compile Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * fix nc tests Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * lint Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * small cleanup Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * decomposedfs: add space if fieldmask is empty, * or has 'space' Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * fix propfind root resource path Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * update tests & changelog Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * storageprovidercache: use stringbuffer to build statKey Signed-off-by: Jörn Friedrich Dreyer <[email protected]> * comment cleanup Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
This reverts commit 2a6ff11.
we don't need to look up the space for spaces based requests. we already have it
fixes owncloud/ocis#1277
fixes owncloud/ocis#2144
fixes owncloud/ocis#3073