From 296d4d7739d8639a81ffb453f8e54ee3adaa0786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20S=C3=A1nchez?= Date: Fri, 21 Aug 2026 11:38:59 -0600 Subject: [PATCH] fix[agent-manager](agent/agent_grpc): fixed sql tenant injection error on list agets request --- agent-manager/agent/agent_imp.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/agent-manager/agent/agent_imp.go b/agent-manager/agent/agent_imp.go index 7c7fb2023..464dc88e8 100644 --- a/agent-manager/agent/agent_imp.go +++ b/agent-manager/agent/agent_imp.go @@ -252,13 +252,16 @@ func (s *AgentService) ListAgents(ctx context.Context, req *ListRequest) (*ListA // Scoped by the caller: the panel asks for one tenant, and only the // platform asks for all of them. - where := "" if req.GetTenantId() != "" { - where = fmt.Sprintf("tenant_id = '%s'", sanitizeTenant(req.GetTenantId())) + filter = append(filter, utils.Filter{ + Field: "tenant_id", + Op: utils.Is, + Value:sanitizeTenant(req.GetTenantId()), + }) } agents := []models.Agent{} - total, err := s.DBConnection.GetByPagination(&agents, page, filter, where, false) + total, err := s.DBConnection.GetByPagination(&agents, page, filter, "", false) if err != nil { catcher.Error("failed to fetch agents", err, map[string]any{"process": "agent-manager"}) return nil, status.Errorf(codes.Internal, "failed to fetch agents: %v", err)