Change
To make CEL environment setup consistent across CEL implementations, I propose to add a runtime option equivalent to CEL-cpp InterpreterOptions.enable_comprehension to CEL-Go and CEL-Java (corresponding ticket https://github.com/google/cel-java/issues/484).
In Java, runtime CEL comprehensions can be limited using comprehensionMaxIterations(int value) runtime option. Setting value to 0 disables the comprehension macros. If the limit is reached, program evaluation throws CelEvaluationException with CelErrorCode.ITERATION_BUDGET_EXCEEDED.
There is no option equivalent to comprehensionMaxIterations() in CEL-Go . Similar to google/cel-java#484, the new Go option equivalent to cpp's enable_comprehension could use comprehensionMaxIterations(0) under-the-hood.
Example
// Actual option names up to the implementer.
prg, err := env.Program(ast, EvalOptions(OptDisableComprehension))
// Equivalent:
prg, err := env.Program(ast, ComprehensionMaxIterations(0))
Feature request checklist
Change To make CEL environment setup consistent across CEL implementations, I propose to add a runtime option equivalent to CEL-cpp
InterpreterOptions.enable_comprehension
to CEL-Go and CEL-Java (corresponding ticket https://github.com/google/cel-java/issues/484).In Java, runtime CEL comprehensions can be limited using
comprehensionMaxIterations(int value)
runtime option. Settingvalue
to 0 disables the comprehension macros. If the limit is reached, program evaluation throwsCelEvaluationException
withCelErrorCode.ITERATION_BUDGET_EXCEEDED
.There is no option equivalent to
comprehensionMaxIterations()
in CEL-Go . Similar to google/cel-java#484, the new Go option equivalent to cpp'senable_comprehension
could usecomprehensionMaxIterations(0)
under-the-hood.Example
Related Internal ref: go/grpc-cel-integration