From ebb7b8ce001abffcce92193d9fd21c5a8443ae30 Mon Sep 17 00:00:00 2001 From: Michelangelo Mori Date: Fri, 12 Jul 2024 11:31:53 +0200 Subject: [PATCH] ListEvaluationHistory now enforces max page size. It is currently valued at the same as the default page size. We might raise it once we have more details about the performance impact of the endpoint. --- internal/controlplane/handlers_evalstatus.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/controlplane/handlers_evalstatus.go b/internal/controlplane/handlers_evalstatus.go index ab2a399742..1e9e16c0f4 100644 --- a/internal/controlplane/handlers_evalstatus.go +++ b/internal/controlplane/handlers_evalstatus.go @@ -37,6 +37,10 @@ import ( const ( defaultPageSize uint64 = 25 + // Maximum page size has a conservative value at the moment, + // we can raise it once we have more insight on its + // performance impact. + maxPageSize uint64 = 25 ) // ListEvaluationHistory lists current and past evaluation results for @@ -63,6 +67,10 @@ func (s *Server) ListEvaluationHistory( size = in.GetCursor().GetSize() } + if size > maxPageSize { + return nil, status.Error(codes.InvalidArgument, "invalid cursor") + } + // process filter opts := []history.FilterOpt{} opts = append(opts, FilterOptsFromStrings(in.GetEntityType(), history.WithEntityType)...)