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

Add public link access via mount-ID:token/relative-path to the scope #2287

Merged
merged 1 commit into from
Nov 17, 2021
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
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