Safe expression engine for computed columns
Computed columns and conditional formatting use a purpose-built expression parser that produces an AST, which is evaluated by an interpreter with an allowlist of operators and functions. It never calls eval, and it bounds depth, length, and evaluation steps.
Planned. This page shows the specification from issue #209. The live example, source for every framework and the API reference replace it when the feature ships.
Live example
An orders grid with an expression editor bound to a computed 'total' column.
Expected behavior
Valid expressions update the column live. Attempts like 'constructor.constructor("x")()' or 'window' fail parsing with a clear error. Exceeding limits shows which limit was hit.
Planned API surface
columns[].expressionexpressionEngine.allowedFunctionsexpressionEngine.maxDepthexpressionEngine.maxLengthexpressionEngine.maxStepsonExpressionErrorparseExpressionAcceptance criteria
- Identifiers resolve only to row fields declared in the column schema. (pending)
- Member access to __proto__, constructor, and prototype is rejected at parse time. (pending)
- Evaluation halts at maxSteps with an error value, not a hang. (pending)
- The engine works under the strict CSP from F05. (pending)
- Errors include position info for the editor. (pending)