From 20392fbce99e4c8a28f10b0d947e802214db731b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Tue, 22 Mar 2022 08:27:29 +0000 Subject: [PATCH] prevent nil by disallowing CreateHome in public scope MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- pkg/auth/scope/publicshare.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/auth/scope/publicshare.go b/pkg/auth/scope/publicshare.go index 7dc8372394..207cd7e2f9 100644 --- a/pkg/auth/scope/publicshare.go +++ b/pkg/auth/scope/publicshare.go @@ -71,6 +71,8 @@ func publicshareScope(ctx context.Context, scope *authpb.Scope, resource interfa } } return checkStorageRef(ctx, &share, ref), nil + case *provider.CreateHomeRequest: + return false, nil case *provider.GetPathRequest: return checkStorageRef(ctx, &share, &provider.Reference{ResourceId: v.GetResourceId()}), nil case *provider.StatRequest: @@ -127,7 +129,7 @@ func publicshareScope(ctx context.Context, scope *authpb.Scope, resource interfa return checkResourcePath(v), nil } - msg := "resource type assertion failed" + msg := "public resource type assertion failed" logger.Debug().Str("scope", "publicshareScope").Interface("resource", resource).Msg(msg) return false, errtypes.InternalError(msg) }