Skip to content

Commit

Permalink
ListEvaluationHistory now enforces max page size. (#3873)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
blkt authored Jul 12, 2024
1 parent 6e4e319 commit 8324246
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/controlplane/handlers_evalstatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)...)
Expand Down

0 comments on commit 8324246

Please sign in to comment.