Strengthen AnalyticsEngineSecurityIT coverage and fix routing - #5683
Strengthen AnalyticsEngineSecurityIT coverage and fix routing#5683finnegancarroll wants to merge 1 commit into
Conversation
PR Code Analyzer ❗AI-powered 'Code-Diff-Analyzer' found issues on commit 6ea9a6a.
The table above displays the top 10 most important findings. Pull Requests Author(s): Please update your Pull Request according to the report above. Repository Maintainer(s): You can Thanks. |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
81223b3 to
dda5c47
Compare
- Add cluster.pluggable.dataformat=composite to testClusters config so wildcard/alias queries route through analytics engine (not legacy PPL) - Remove try/catch fallbacks that masked 500s as passing tests - Add assertDataRowsPresent() and assertContainsName() for data validation - New tests: partial wildcard deny, multi-backing alias allow/deny, no-cluster-permission deny Signed-off-by: Finn Carroll <carrofin@amazon.com>
d26a625 to
88a7b24
Compare
Strengthen AnalyticsEngineSecurityIT coverage and fix routing
Routing fix for analytics engine security plugin tests
The SQL plugin routes queries to the analytics engine based on
isAnalyticsIndex(), which checks whether the target index uses the composite data format. Previously, this check only worked for concrete index names — it performs a directMetadata.index(name)lookup which does not resolve wildcards, aliases, or multi-index expressions. Queries usingsource = analytics_*orsource = my_aliaswould silently fall back to the legacy PPL backend because the lookup returned null for non-concrete names.This meant wildcard, alias, and some multi-index security tests were passing but testing the legacy PPL path's security behavior, not the analytics engine's. The concrete-index tests (e.g.,
testPPLQueryDeniedWithSearchPermissionOnly) correctly validated analytics engine routing, but the wildcard/alias ALLOW tests masked the routing gap withtry/catchfallbacks.The fix adds
cluster.pluggable.dataformat=composite(pluscluster.composite.secondary_data_formats=["lucene"]) to thetestClusters.analyticsEngineSecurityITconfiguration. This activates the cluster-level fast path inisAnalyticsIndex(), ensuring ALL queries route through the analytics engine regardless of source format.To prevent future silent fallback regressions, we add three routing guard tests that use
profile=true. The analytics engine returns a"profile"key containing engine-specific execution details (stage timings, physical plans, DataFusion metrics) that are distinct from the legacy PPL profile output. If a query silently falls back to the legacy path, the response structure will differ and these tests will fail:testRoutingGuardConcreteIndextestRoutingGuardWildcardSourcetestRoutingGuardAliasTest assertion enhancements
Removed
try/catch(ResponseException)fallbacks that previously masked non-403 errors (including 500s) as passing tests. ALLOW tests now assert HTTP 200, validate non-emptydatarows, and check actual row content (e.g.,assertContainsName("alice")). DENY tests assert 403 status AND validate that the error body references the denied action or contains "no permissions". Also validates that 403 responses do not leak internal stack traces or node IDs.New test coverage
testRoutingGuardConcreteIndextestRoutingGuardWildcardSourcetestRoutingGuardAliastestPPLCommaSourceAllAuthorizedtestPPLCommaSourcePartiallyAuthorizedtestPPLMultiIndexDeniedWithBackticksAuthorizedFirsttestPPLMultiIndexDeniedWithUnauthorizedFirsttestPPLQueryAllowedViaConcreteIndexForAliasUsertestPPLQueryDeniedWithoutClusterPermissiontestPPLQueryMultiBackingAliasAllowedtestPPLQueryMultiBackingAliasDeniedtestPPLQueryMultiBackingAliasPartialAccessDeniedtestPPLQueryWithWildcardSourceAllowedtestPPLQueryWithWildcardSourceDeniedtestPPLQueryWithWildcardSourcePartialAccessDeniedtestSQLQueryAllowedWithWildcardPermissiontestSQLQueryDeniedWithWildcardPermissionOnNonMatchingIndextestSQLQueryAllowedViaAliastestSQLQueryWithExactAnalyticsPermissiontestDeniedResponseContainsActionNametestDeniedResponseDoesNotLeakInternalDetailsTesting
All 40 tests pass on a local cluster with analytics engine plugins built from current
main.