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

ocdav: skip space lookup on spaces propfind #2977

Merged
merged 24 commits into from
Jul 6, 2022

Conversation

butonic
Copy link
Contributor

@butonic butonic commented Jun 16, 2022

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

@update-docs
Copy link

update-docs bot commented Jun 16, 2022

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.

@lgtm-com
Copy link

lgtm-com bot commented Jun 16, 2022

This pull request introduces 3 alerts when merging b6f7a4f into f7b1b5f - view on LGTM.com

new alerts:

  • 3 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Jun 16, 2022

This pull request introduces 3 alerts when merging f23e075 into f7b1b5f - view on LGTM.com

new alerts:

  • 3 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Jun 16, 2022

This pull request introduces 3 alerts when merging 5be2321 into dffcaf7 - view on LGTM.com

new alerts:

  • 3 for Useless assignment to local variable

@butonic butonic force-pushed the skip-space-lookup-on-space-propfind branch 8 times, most recently from c32a25d to ea1a285 Compare June 22, 2022 18:15
@butonic butonic force-pushed the skip-space-lookup-on-space-propfind branch 4 times, most recently from 5d106bc to 6d6beee Compare June 30, 2022 13:51
@butonic butonic marked this pull request as ready for review June 30, 2022 14:25
@butonic butonic requested review from labkode, ishank011, glpatcern and a team as code owners June 30, 2022 14:25
internal/grpc/services/gateway/storageprovidercache.go Outdated Show resolved Hide resolved
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()}})
Copy link
Contributor

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?

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 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.

Copy link
Contributor

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?

Copy link
Contributor Author

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.

internal/http/services/owncloud/ocdav/locks.go Outdated Show resolved Hide resolved
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()}})
Copy link
Contributor

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/propfind/propfind.go Outdated Show resolved Hide resolved
internal/http/services/owncloud/ocdav/propfind/propfind.go Outdated Show resolved Hide resolved
internal/http/services/owncloud/ocdav/report.go Outdated Show resolved Hide resolved
internal/http/services/owncloud/ocdav/versions.go Outdated Show resolved Hide resolved
@butonic butonic force-pushed the skip-space-lookup-on-space-propfind branch from b21ce72 to a40f558 Compare July 6, 2022 07:38
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
butonic added 16 commits July 6, 2022 07:39
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
@butonic butonic force-pushed the skip-space-lookup-on-space-propfind branch from a40f558 to 0d040c3 Compare July 6, 2022 07:39
@butonic butonic merged commit e2232b5 into cs3org:edge Jul 6, 2022
@butonic butonic deleted the skip-space-lookup-on-space-propfind branch July 6, 2022 20:01
kobergj pushed a commit that referenced this pull request Jul 7, 2022
* ocdav: skip space lookup on spaces propfind

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* add changelog

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* update unit test

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* lint

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* reduce stat requests

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* update propfind unit tests

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* fix moq propfind comparison in propfind tests

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* lint

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* error handling and response codes

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* remove commented code

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* typos, mimic oc10 not found error message

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* add fieldmask to ListContainer and Stat

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* mimic oc10 not found error message

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* mimic oc10 not found error message in more places

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* fix oc:permissions

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* fix test compile

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* fix nc tests

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* lint

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* small cleanup

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* decomposedfs: add space if fieldmask is empty, * or has 'space'

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* fix propfind root resource path

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* update tests & changelog

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* storageprovidercache: use stringbuffer to build statKey

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* comment cleanup

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
kobergj pushed a commit to kobergj/reva that referenced this pull request Jul 11, 2022
* ocdav: skip space lookup on spaces propfind

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* add changelog

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* update unit test

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* lint

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* reduce stat requests

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* update propfind unit tests

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* fix moq propfind comparison in propfind tests

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* lint

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* error handling and response codes

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* remove commented code

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* typos, mimic oc10 not found error message

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* add fieldmask to ListContainer and Stat

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* mimic oc10 not found error message

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* mimic oc10 not found error message in more places

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* fix oc:permissions

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* fix test compile

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* fix nc tests

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* lint

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* small cleanup

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* decomposedfs: add space if fieldmask is empty, * or has 'space'

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* fix propfind root resource path

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* update tests & changelog

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* storageprovidercache: use stringbuffer to build statKey

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* comment cleanup

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
kobergj added a commit to kobergj/reva that referenced this pull request Jul 14, 2022
@micbar micbar mentioned this pull request Jul 19, 2022
36 tasks
@kobergj kobergj mentioned this pull request Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants