Add SQL input sanitization utilities - #19352
Merged
Merged
Conversation
Jackie-Jiang
approved these changes
Aug 24, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #19352 +/- ##
============================================
+ Coverage 67.13% 67.14% +0.01%
Complexity 1424 1424
============================================
Files 3468 3468
Lines 222432 222546 +114
Branches 35015 35048 +33
============================================
+ Hits 149329 149439 +110
+ Misses 61200 61192 -8
- Partials 11903 11915 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
xiangfu0
force-pushed
the
codex/sql-identifier-utils
branch
from
August 24, 2026 21:36
c7691e1 to
957ede8
Compare
Centralize parser-backed validation for dynamically generated SQL so callers share identifier quoting, aggregation validation, and predicate checks. This lets downstream query builders such as StarTree QueryGenerator delegate validation instead of maintaining parallel security logic.
xiangfu0
force-pushed
the
codex/sql-identifier-utils
branch
from
August 24, 2026 23:28
957ede8 to
93213e6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds shared
ParserUtilshelpers for safely constructing SQL from dynamic inputs:sanitizeIdentifierpreserves valid bare identifiers and wildcards, normalizes quoted qualified names, and quotes unsafe componentssanitizeAggregationFunctionaccepts only registered Pinot aggregation functionssanitizePredicaterejects statement separators/comments outside quoted content and requires the complete predicate to compile as a Pinot SQL expression, while allowing valid right-hand-side column referencesThe identifier path avoids qualified-name allocation for the common unquoted case. These utilities let downstream query builders, including startreedata/startree-pinot#4093, delegate validation instead of maintaining parallel security logic.
Validation:
ParserUtilsTest: 64 tests, 0 failurespinot-commonspotless, license, and checkstyle checkspinot-commontest compilation with JDK 25git diff --check