From 61c706dd961aa353222f48852a0f5433fc3d9226 Mon Sep 17 00:00:00 2001 From: "maksim.nabokikh" Date: Thu, 5 Mar 2026 11:50:02 +0100 Subject: [PATCH] Enhance size estimation for various field types in cost.go Signed-off-by: maksim.nabokikh --- pkg/cel/cost.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/cel/cost.go b/pkg/cel/cost.go index b3e3610d..7ddad80d 100644 --- a/pkg/cel/cost.go +++ b/pkg/cel/cost.go @@ -65,8 +65,16 @@ func (defaultCostEstimator) EstimateSize(element checker.AstNode) *checker.SizeE field := path[1] switch field { case "groups", "scopes": + // list(string) fields + return &checker.SizeEstimate{Min: 0, Max: DefaultListMaxLength} + case "email_verified": + // bool field — size is always 1 + return &checker.SizeEstimate{Min: 1, Max: 1} + case "redirect_uris": + // list(string) field on request return &checker.SizeEstimate{Min: 0, Max: DefaultListMaxLength} default: + // string fields (email, username, user_id, client_id, etc.) return &checker.SizeEstimate{Min: 0, Max: DefaultStringMaxLength} } }