cel-rust icon indicating copy to clipboard operation
cel-rust copied to clipboard

Provide a mechanism for limiting the number of expressions

Open lucperkins opened this issue 1 year ago • 4 comments

Providing massive expressions is a good way to bring down a server. It's pretty trivial to, for example, write a little script that creates an "or" chain 100,000 Booleans long. Because of this, it'd be good to provide support for optionally limiting the number of expressions evaluated by a Program.

lucperkins avatar Jun 25 '24 18:06 lucperkins

I have some ideas on how to make this happen and am happy to do the work. Just wanted to see if I encounter any resistance before I submit a PR 😄

lucperkins avatar Jun 25 '24 18:06 lucperkins

No resistance from me! That's actually something I've been thinking about recently. I know other CEL implementations do something similar to this, i.e. cel-go.

clarkmcc avatar Jun 25 '24 20:06 clarkmcc

@clarkmcc Oh, nice! I was not aware of that implementation, but great to know. Glad you're amenable to this 😄 I'll submit a PR pretty soon here.

lucperkins avatar Jun 25 '24 22:06 lucperkins

Documenting for posterity: this should probably be our guiding star for expression cost estimation/limiting.

clarkmcc avatar Jul 22 '24 14:07 clarkmcc