From 7fb08b27903f34be15ac21b9f97eb6aae6e7a128 Mon Sep 17 00:00:00 2001 From: Raffaele Meyer Date: Tue, 30 May 2023 11:26:16 +0200 Subject: [PATCH] Expose ExpressionSizeCodePointLimit as env option. --- cel/options.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cel/options.go b/cel/options.go index 63321b54..07f3d6c7 100644 --- a/cel/options.go +++ b/cel/options.go @@ -568,3 +568,12 @@ func ParserRecursionLimit(limit int) EnvOption { return e, nil } } + +// ParserExpressionSizeLimit adjusts the number of code points the expression parser is allowed to parse. +// Defaults defined in the parser package. +func ParserExpressionSizeLimit(limit int) EnvOption { + return func(e *Env) (*Env, error) { + e.prsrOpts = append(e.prsrOpts, parser.ExpressionSizeCodePointLimit(limit)) + return e, nil + } +}