google / cel-go

Fast, portable, non-Turing complete expression evaluation with gradual typing (Go)
https://cel.dev
Apache License 2.0
2.2k stars 218 forks source link

Make subsetting the standard environment simple #290

Open TristonianJones opened 4 years ago

TristonianJones commented 4 years ago

Feature request checklist

Change Currently it is easy to extend a standard environment, but painful to subset it. Effectively, the user must copy and paste code from the supported library which is less than ideal.

Make it possible to specify in terms of types and operators which functionality they would like to support and ensure that only this subset is exposed at check-time and evaluation time.

TristonianJones commented 4 years ago

Custom environments are difficult to construct since its non-trivial to subset the standard CEL environment. In addressing this feature request an example, as requested in #344, should be added to the cel_test.go file.

TristonianJones commented 4 years ago

Note, https://github.com/google/cel-policy-templates-go/pull/14 permits the specification of a CEL environment via YAML and would be a good reference for supporting environment subsetting.