Skip to content

Commit

Permalink
Add public link access via mount-ID:token/relative-path to the scope (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ishank011 authored Nov 17, 2021
1 parent 87c8612 commit 427e944
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelog/unreleased/public-link-token-scope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Bugfix: Add public link access via mount-ID:token/relative-path to the scope

https://github.com/cs3org/reva/pull/2287
6 changes: 4 additions & 2 deletions pkg/auth/scope/publicshare.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,11 @@ func publicshareScope(ctx context.Context, scope *authpb.Scope, resource interfa
}

func checkStorageRef(ctx context.Context, s *link.PublicShare, r *provider.Reference) bool {
// r: <resource_id:<storage_id:$storageID opaque_id:$opaqueID> path:$path > >
// r: <resource_id:<storage_id:$storageID opaque_id:$opaqueID> >
// OR
// r: <resource_id:<storage_id:$public-storage-mount-ID opaque_id:$token/$relative-path> >
if r.ResourceId != nil && r.Path == "" { // path must be empty
return utils.ResourceIDEqual(s.ResourceId, r.GetResourceId())
return utils.ResourceIDEqual(s.ResourceId, r.GetResourceId()) || strings.HasPrefix(r.ResourceId.OpaqueId, s.Token)
}

// r: <path:"/public/$token" >
Expand Down

0 comments on commit 427e944

Please sign in to comment.