From ad926f04d81a376ee1c19de04e149bd59f76c4e7 Mon Sep 17 00:00:00 2001 From: notyourusualaccountname2 <135010231+notyourusualaccountname2@users.noreply.github.com> Date: Tue, 30 May 2023 19:02:57 +0200 Subject: [PATCH] Expose ExpressionSizeCodePointLimit as env option. (#720) --- 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 + } +}