From 6e748a9ee78f502ed7d2e71da32fc1698d4af464 Mon Sep 17 00:00:00 2001 From: Georges Chaudy Date: Fri, 7 Feb 2025 12:32:45 +0100 Subject: [PATCH] fix: Ensure we check the user identity for search (#100190) Ensure we check the user identity for search --- pkg/registry/apis/dashboard/authorizer.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/registry/apis/dashboard/authorizer.go b/pkg/registry/apis/dashboard/authorizer.go index 1281349a6f2..0b51cd32c68 100644 --- a/pkg/registry/apis/dashboard/authorizer.go +++ b/pkg/registry/apis/dashboard/authorizer.go @@ -16,7 +16,7 @@ func GetAuthorizer(dashboardService dashboards.DashboardService, l log.Logger) a return authorizer.AuthorizerFunc( func(ctx context.Context, attr authorizer.Attributes) (authorized authorizer.Decision, reason string, err error) { // Use the standard authorizer - if !attr.IsResourceRequest() || attr.GetResource() == "search" { + if !attr.IsResourceRequest() { return authorizer.DecisionNoOpinion, "", nil } @@ -25,7 +25,8 @@ func GetAuthorizer(dashboardService dashboards.DashboardService, l log.Logger) a return authorizer.DecisionDeny, "", err } - if attr.GetName() == "" { + // Allow search and list requests + if attr.GetResource() == "search" || attr.GetName() == "" { return authorizer.DecisionNoOpinion, "", nil }