fix: DH-22165: Validate AggSpecFormula through ColumnExpressionValidator.#7933
fix: DH-22165: Validate AggSpecFormula through ColumnExpressionValidator.#7933cpwright wants to merge 10 commits intodeephaven:mainfrom
Conversation
AggregateAllGrpcImpl passed AggSpec directly to aggAllBy without invoking ColumnExpressionValidator, and AggregateGrpcImpl.validateFormulas did not inspect AggregationColumns whose inner AggSpec was AggSpecFormula. Both paths let an arbitrary formula string reach the engine's compiler, enabling remote code execution (e.g. Runtime.getRuntime().exec(...)) via gRPC. Add a shared AggSpecFormulaValidator that substitutes the paramToken with each target column name using the same FormulaUtil.replaceFormulaTokens helper the engine uses at runtime, then runs the result through ColumnExpressionValidator.validateColumnExpressions against a grouped prototype table. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
translateAndValidateFormatViews read from request.getUpdateViewsList() instead of request.getFormatViewsList(), so format view expressions were never validated. A client sending malicious format_views with an empty update_views list would pass the validator (on a zero-length array) and have the real format expressions compiled and executed by the engine — the same RCE class as the AggSpecFormula gap. No regression test is included: there is no existing gRPC test harness for HierarchicalTableServiceGrpcImpl, and the minimum viable fixture (rollup/tree source, HierarchicalTable export wiring, apply response plumbing) is materially more work than the fix itself. The fix is a single-line swap that reads identically to the adjacent, correctly implemented translateAndValidateUpdateViews method. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
No docs changes detected for b2f2a55 |
There was a problem hiding this comment.
Pull request overview
This PR adds server-side validation for AggSpecFormula aggregations by running the formula through ColumnExpressionValidator (covering both aggregate and aggregateAll paths) and adds regression tests for allowed vs disallowed expressions.
Changes:
- Validate
AggSpecFormulaexpressions forAggregateRequest(columns aggregation) andAggregateAllRequestbefore execution. - Add tests asserting disallowed expressions are rejected and benign expressions succeed.
- Fix
HierarchicalTableServiceGrpcImplto validateformatViewsusing the correct request list.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| server/src/test/java/io/deephaven/server/table/ops/AggregateGrpcTest.java | Adds tests for formula spec validation in aggregate column aggregations. |
| server/src/test/java/io/deephaven/server/table/ops/AggregateAllGrpcTest.java | Adds tests for formula spec validation in aggregateAll. |
| server/src/main/java/io/deephaven/server/table/ops/AggregateGrpcImpl.java | Validates AggSpecFormula for AggregationColumns by extracting input columns and invoking validator. |
| server/src/main/java/io/deephaven/server/table/ops/AggregateAllGrpcImpl.java | Injects ColumnExpressionValidator and validates formula specs for aggAllBy. |
| server/src/main/java/io/deephaven/server/table/ops/AggSpecFormulaValidator.java | New shared helper to validate substituted formulas against grouped-table prototypes. |
| server/src/main/java/io/deephaven/server/hierarchicaltable/HierarchicalTableServiceGrpcImpl.java | Uses getFormatViewsList() when translating/validating format views. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
8c20b3d to
1515fda
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.