From d894e888b829627f710bd08fa701cc74da6cbda5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Tue, 25 Oct 2022 22:46:21 +0200 Subject: [PATCH] fix generic plugin error message. --- pkg/auth/auth.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/auth/auth.go b/pkg/auth/auth.go index 24c5b2fc..e578e05b 100644 --- a/pkg/auth/auth.go +++ b/pkg/auth/auth.go @@ -80,13 +80,17 @@ func PluginsGenericOnly[V comparable](key string, exp V) func(w http.ResponseWri plugins := session.Profile().Plugins + if plugins[key] == nil { + return nil, utils.HttpForbidden(fmt.Sprintf("missing plugin permission: %s=%T", key, exp)) + } + val, ok := plugins[key].(V) if !ok { - return nil, utils.HttpForbidden(fmt.Sprintf("%s is %T, but expected %T", key, plugins[key], exp)) + return nil, utils.HttpForbidden(fmt.Sprintf("invalid plugin permission type: %s=%T expected %T", key, plugins[key], exp)) } if val != exp { - return nil, utils.HttpForbidden(fmt.Sprintf("%s is set to %v, but expected %v", key, val, exp)) + return nil, utils.HttpForbidden(fmt.Sprintf("wrong plugin permission value for %s=%T", key, exp)) } return nil, nil