Skip to content

Commit

Permalink
Fix access to spaces shared via public link (#3451)
Browse files Browse the repository at this point in the history
* Fix access to spaces shared via public link

* Add changelog
  • Loading branch information
aduffeck authored Nov 11, 2022
1 parent fffaf0f commit 413c0a3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
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

0 comments on commit 413c0a3

Please sign in to comment.