From de22a2ca71efa06e162efc752d8d9e9cf96aeca0 Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Mon, 16 Dec 2024 19:09:19 +0300 Subject: [PATCH] merge main --- pkg/services/apiserver/auth/authorizer/stack_id.go | 7 ++++--- pkg/services/apiserver/builder/helper.go | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/services/apiserver/auth/authorizer/stack_id.go b/pkg/services/apiserver/auth/authorizer/stack_id.go index c31e0c3f62b..5b44c09161c 100644 --- a/pkg/services/apiserver/auth/authorizer/stack_id.go +++ b/pkg/services/apiserver/auth/authorizer/stack_id.go @@ -5,11 +5,12 @@ import ( "fmt" "strconv" + "k8s.io/apiserver/pkg/authorization/authorizer" + "github.com/grafana/authlib/claims" "github.com/grafana/grafana/pkg/apimachinery/identity" "github.com/grafana/grafana/pkg/infra/log" "github.com/grafana/grafana/pkg/setting" - "k8s.io/apiserver/pkg/authorization/authorizer" ) var _ authorizer.Authorizer = &stackIDAuthorizer{} @@ -45,9 +46,9 @@ func (auth stackIDAuthorizer) Authorize(ctx context.Context, a authorizer.Attrib if info.Value == "" { return authorizer.DecisionNoOpinion, "", nil } - if info.StackID != auth.stackID { - return authorizer.DecisionDeny, "wrong stack id is selected", nil + msg := fmt.Sprintf("wrong stack id is selected (expected: %d, found %d)", auth.stackID, info.StackID) + return authorizer.DecisionDeny, msg, nil } if info.OrgID != 1 { return authorizer.DecisionDeny, "cloud instance requires org 1", nil diff --git a/pkg/services/apiserver/builder/helper.go b/pkg/services/apiserver/builder/helper.go index 6670651094e..5b7bc543392 100644 --- a/pkg/services/apiserver/builder/helper.go +++ b/pkg/services/apiserver/builder/helper.go @@ -193,7 +193,7 @@ func SetupConfig( w := csv.NewWriter(f) if isNew { - w.Write([]string{ + _ = w.Write([]string{ "#Path", "Method", "action", @@ -205,7 +205,7 @@ func SetupConfig( "metadata", }) } - w.Write([]string{ + _ = w.Write([]string{ r.Path(), r.Method(), action,