Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ProgramOptions to limit and disable comprehension macros #1050

Open
2 of 3 tasks
sergiitk opened this issue Oct 24, 2024 · 0 comments
Open
2 of 3 tasks

Support ProgramOptions to limit and disable comprehension macros #1050

sergiitk opened this issue Oct 24, 2024 · 0 comments

Comments

@sergiitk
Copy link
Member

Feature request checklist

  • There are no issues that match the desired change
  • The change is large enough it can't be addressed with a simple Pull Request
  • If this is a bug, please file a Bug Report.

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 google/cel-java#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))

Related
Internal ref: go/grpc-cel-integration

@sergiitk sergiitk changed the title Support runtime options to limit or disable comprehension macros Support runtime options to limit and disable comprehension macros Oct 24, 2024
@sergiitk sergiitk changed the title Support runtime options to limit and disable comprehension macros Support ProgramOptions to limit and disable comprehension macros Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant