Fix multi index resolution on analytics engine - #22314
Conversation
PPL multi-source queries (source=idx1,idx2) produce a single TableScan with a comma-delimited table name. RelNodeUtils.extractIndices() was returning this as one array element (e.g. ["idx1,idx2"]) causing the security filter to see a single non-existent index name, resolve to zero concrete indices, and skip permission evaluation entirely. Fix: split comma-delimited table names using Strings.splitStringByCommaToArray() — the same utility used by IndexResolution in the planner — so each index is extracted as a separate entry. The security filter then evaluates permissions on each index independently and correctly denies unauthorized access. Reproduction: with cluster.pluggable.dataformat=composite, a user with logs-* permissions could query source=logs-2024-01,secrets-2024-01 and bypass FGAC because the joined string passed through security unchecked. Signed-off-by: Finnegan Carroll <carrofin@amazon.com> Signed-off-by: Finn Carroll <carrofin@amazon.com>
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #22314 +/- ##
============================================
- Coverage 73.35% 73.32% -0.03%
+ Complexity 76086 76000 -86
============================================
Files 6075 6075
Lines 345371 345371
Branches 49718 49718
============================================
- Hits 253348 253253 -95
- Misses 71838 71850 +12
- Partials 20185 20268 +83 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| } | ||
|
|
||
| public void testDoubleCommaProducesEmptyStringFiltered() { | ||
| RelBuilder b = builderWithTable("index1,,index2"); |
There was a problem hiding this comment.
So, Vanilla allows incorrectly parsed names ?
There was a problem hiding this comment.
some of these might be rejected up front by sql/ppl before making it into AE. I'm unsure. Adding SQL plugin integ tests for this PR here opensearch-project/sql#5581 and will cover these cases.
PPL multi-source queries (source=idx1,idx2) produce a single TableScan with a comma-delimited table name. RelNodeUtils.extractIndices() was returning this as one array element (e.g. ["idx1,idx2"]) causing the security filter to see a single non-existent index name, resolve to zero concrete indices, and skip permission evaluation entirely. Fix: split comma-delimited table names using Strings.splitStringByCommaToArray() — the same utility used by IndexResolution in the planner — so each index is extracted as a separate entry. The security filter then evaluates permissions on each index independently and correctly denies unauthorized access. Reproduction: with cluster.pluggable.dataformat=composite, a user with logs-* permissions could query source=logs-2024-01,secrets-2024-01 and bypass FGAC because the joined string passed through security unchecked. Signed-off-by: Finnegan Carroll <carrofin@amazon.com> Signed-off-by: Finn Carroll <carrofin@amazon.com>
Description
RelNodeUtils.extractIndices()returned comma-delimited table names as a single array element (e.g.["idx1,idx2"]). The security filter'sIndexNameExpressionResolvertried to resolve this as one index name, was unable to, and resolved no concrete indices.Due to the default setting of strict expand open on analytics query request index resolution errors are not fatal.
Fix
Split comma-delimited table names in
collectIndices()usingStrings.splitStringByCommaToArray()(same utility used byIndexResolutionin the planner). Each index is now a separate entry in theString[]array, so security evaluates permissions on each independently.