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

Fix access to spaces shared via public link #3451

Merged
merged 2 commits into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog/unreleased/fix-space-public-links.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Fix access to spaces shared via public link

We fixed a problem where downloading archives from spaces which were shared via
public links was not possible.

https://github.com/cs3org/reva/pull/3452
16 changes: 12 additions & 4 deletions internal/grpc/interceptors/auth/scope.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,19 @@ func checkRelativeReference(ctx context.Context, requested *provider.Reference,

sharedResource := sRes.Info

parentID := sharedResource.ParentId
parentID.StorageId = sharedResource.Id.StorageId
// Is this a shared space
if sharedResource.ParentId == nil {
// Is the requested resource part of the shared space?
if requested.ResourceId.StorageId != sharedResource.Id.StorageId || requested.ResourceId.SpaceId != sharedResource.Id.SpaceId {
return errtypes.PermissionDenied("access forbidden via public link")
}
} else {
parentID := sharedResource.ParentId
parentID.StorageId = sharedResource.Id.StorageId

if !utils.ResourceIDEqual(parentID, requested.ResourceId) && utils.MakeRelativePath(sharedResource.Path) != requested.Path {
return errtypes.PermissionDenied("access not allowed for via public share")
if !utils.ResourceIDEqual(parentID, requested.ResourceId) && utils.MakeRelativePath(sharedResource.Path) != requested.Path {
return errtypes.PermissionDenied("access forbidden via public link")
}
}

key := storagespace.FormatResourceID(*sharedResourceID) + scopeDelimiter + getRefKey(requested)
Expand Down