Skip to content

Add dsl-query-executor sandbox plugin for dsl query execution via analytics engine#20916

Merged
mch2 merged 9 commits into
opensearch-project:mainfrom
vinaykpud:feature/dsl-converter
Mar 30, 2026
Merged

Add dsl-query-executor sandbox plugin for dsl query execution via analytics engine#20916
mch2 merged 9 commits into
opensearch-project:mainfrom
vinaykpud:feature/dsl-converter

Conversation

@vinaykpud
Copy link
Copy Markdown
Contributor

@vinaykpud vinaykpud commented Mar 18, 2026

Introduces a new sandbox plugin related to this issue that intercepts _search requests and routes them through a execution pipeline via the analytics engine.

Description

This PR introduces the dsl-query-executor sandbox plugin skeleton with end-to-end wiring: action filter → transport action → converter → executor → response builder.

The converter currently produces a LogicalTableScan RelNode only, the executor returns empty rows (analytics engine stub), and the response builder constructs an empty SearchResponse. Actual DSL-to-RelNode conversion, execution, and response population will be added incrementally in follow-up PRs.

Related Issues

#20914

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 18, 2026

PR Code Analyzer ❗

AI-powered 'Code-Diff-Analyzer' found issues on commit ac00e6f.

PathLineSeverityDescription
sandbox/plugins/dsl-query-executor/src/main/java/org/opensearch/dsl/action/SearchActionFilter.java57mediumThe filter intercepts ALL _search requests (not just those targeting specific indices) and re-dispatches them as DslExecuteAction (indices:data/read/dsl/execute). The Security plugin at order 0 authorized the original 'indices:data/read/search' action, but the re-dispatched action uses a different action name that may not have a corresponding security rule, creating a potential authorization bypass path. The code itself acknowledges this gap in a TODO comment in DslExecuteAction.java.
sandbox/libs/analytics-framework/build.gradle35lowAddition of janino:3.1.9 and commons-compiler:3.1.9 introduces a runtime Java bytecode compiler into the analytics framework classloader. While legitimately required by Calcite for expression compilation, these libraries enable dynamic code generation at runtime, which expands the attack surface if query inputs are not properly sanitized in future plan-building code.

The table above displays the top 10 most important findings.

Total: 2 | Critical: 0 | High: 0 | Medium: 1 | Low: 1


Pull Requests Author(s): Please update your Pull Request according to the report above.

Repository Maintainer(s): You can bypass diff analyzer by adding label skip-diff-analyzer after reviewing the changes carefully, then re-run failed actions. To re-enable the analyzer, remove the label, then re-run all actions.


⚠️ Note: The Code-Diff-Analyzer helps protect against potentially harmful code patterns. Please ensure you have thoroughly reviewed the changes beforehand.

Thanks.

@vinaykpud vinaykpud force-pushed the feature/dsl-converter branch from 15934a6 to dd475b2 Compare March 18, 2026 21:44
@vinaykpud vinaykpud changed the title Add dsl-query-executor sandbox plugin for DSL-to-Calcite query execution Add dsl-query-executor sandbox plugin for dsl query execution via analytics engine Mar 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

PR Code Analyzer ❗

AI-powered 'Code-Diff-Analyzer' found issues on commit dd475b2.

PathLineSeverityDescription
sandbox/plugins/dsl-query-executor/src/main/java/org/opensearch/dsl/action/SearchActionFilter.java44mediumorder() returns Integer.MIN_VALUE, ensuring this filter executes before all other action filters — including security/authorization filters from plugins like OpenSearch Security. Any search request is routed to the DSL executor before authorization is checked, which could allow unauthenticated or unauthorized queries to reach the analytics engine. This is the lowest possible filter order and circumvents the standard security filter chain. While the sandbox context makes intentional malice unlikely, this pattern warrants scrutiny in any deployment.
sandbox/plugins/dsl-query-executor/src/main/java/org/opensearch/dsl/action/SearchActionFilter.java54lowEvery _search request is unconditionally intercepted and rerouted to the DSL executor regardless of the target index or whether DSL processing is desired. A TODO comment in SearchActionFilterTests acknowledges this should be conditional on a per-index setting but is not yet implemented. In its current form, enabling this plugin globally diverts all search traffic through a stub pipeline that returns empty hits, which could be exploited as a denial-of-service vector against search functionality.

The table above displays the top 10 most important findings.

Total: 2 | Critical: 0 | High: 0 | Medium: 1 | Low: 1


Pull Requests Author(s): Please update your Pull Request according to the report above.

Repository Maintainer(s): You can bypass diff analyzer by adding label skip-diff-analyzer after reviewing the changes carefully, then re-run failed actions. To re-enable the analyzer, remove the label, then re-run all actions.


⚠️ Note: The Code-Diff-Analyzer helps protect against potentially harmful code patterns. Please ensure you have thoroughly reviewed the changes beforehand.

Thanks.

@vinaykpud vinaykpud marked this pull request as ready for review March 18, 2026 21:52
@vinaykpud vinaykpud requested a review from a team as a code owner March 18, 2026 21:52
Copy link
Copy Markdown
Contributor

@nssuresh2007 nssuresh2007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Contributor

@expani expani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes @vinaykpud Looks like a great start.

Dropped some comments mostly requiring changes in Analytics framework and plugins.

We can add TODO or resolve minor one's to start with and then eventually implement the most optimal solution.

Comment thread sandbox/plugins/dsl-query-executor/build.gradle
@vinaykpud vinaykpud added the skip-diff-analyzer Maintainer to skip code-diff-analyzer check, after reviewing issues in AI analysis. label Mar 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Failed to generate code suggestions for PR

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 671ac61: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

Failed to generate code suggestions for PR

@vinaykpud vinaykpud added the skip-diff-reviewer Maintainer to skip code-diff-reviewer check, after reviewing issues in AI analysis. label Mar 27, 2026
@vinaykpud vinaykpud force-pushed the feature/dsl-converter branch 2 times, most recently from 0a0e7a6 to e53b96a Compare March 27, 2026 20:26
@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for e53b96a: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 0ffbc81: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

✅ Gradle check result for 9b0add8: SUCCESS

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 99.07407% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 73.21%. Comparing base (dbe98aa) to head (962ba1c).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
.../opensearch/dsl/executor/DslQueryPlanExecutor.java 95.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##               main   #20916    +/-   ##
==========================================
  Coverage     73.21%   73.21%            
- Complexity    72620    72729   +109     
==========================================
  Files          5849     5868    +19     
  Lines        332066   332573   +507     
  Branches      47951    48006    +55     
==========================================
+ Hits         243109   243495   +386     
- Misses        69456    69572   +116     
- Partials      19501    19506     +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Introduces a new sandbox plugin that intercepts _search requests and
routes them through a execution pipeline via the analytics engine.

Signed-off-by: Vinay Krishna Pudyodu <vinkrish.neo@gmail.com>
Signed-off-by: Vinay Krishna Pudyodu <vinkrish.neo@gmail.com>
Signed-off-by: Vinay Krishna Pudyodu <vinkrish.neo@gmail.com>
Signed-off-by: Vinay Krishna Pudyodu <vinkrish.neo@gmail.com>
Signed-off-by: Vinay Krishna Pudyodu <vinkrish.neo@gmail.com>
Signed-off-by: Vinay Krishna Pudyodu <vinkrish.neo@gmail.com>
Signed-off-by: Vinay Krishna Pudyodu <vinkrish.neo@gmail.com>
Signed-off-by: Vinay Krishna Pudyodu <vinkrish.neo@gmail.com>
@vinaykpud vinaykpud force-pushed the feature/dsl-converter branch from 9b0add8 to f91520e Compare March 30, 2026 02:03
@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for f91520e: null

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@vinaykpud vinaykpud force-pushed the feature/dsl-converter branch from f91520e to 008c209 Compare March 30, 2026 10:28
Signed-off-by: Vinay Krishna Pudyodu <vinkrish.neo@gmail.com>
@vinaykpud vinaykpud force-pushed the feature/dsl-converter branch from 008c209 to 962ba1c Compare March 30, 2026 10:29
@github-actions
Copy link
Copy Markdown
Contributor

✅ Gradle check result for 962ba1c: SUCCESS

@mch2 mch2 merged commit ed4e32c into opensearch-project:main Mar 30, 2026
24 checks passed
gagandhakrey pushed a commit to gagandhakrey/OpenSearch that referenced this pull request Apr 1, 2026
…lytics engine (opensearch-project#20916)

Signed-off-by: Gagan Dhakrey <gagandhakrey@Gagans-MacBook-Pro.local>
bharath-techie pushed a commit to bharath-techie/OpenSearch that referenced this pull request Apr 2, 2026
aparajita31pandey pushed a commit to aparajita31pandey/OpenSearch that referenced this pull request Apr 18, 2026
…lytics engine (opensearch-project#20916)

Signed-off-by: Aparajita Pandey <aparajita31pandey@gmail.com>
pradeep-L pushed a commit to pradeep-L/OpenSearch that referenced this pull request Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog skip-diff-analyzer Maintainer to skip code-diff-analyzer check, after reviewing issues in AI analysis. skip-diff-reviewer Maintainer to skip code-diff-reviewer check, after reviewing issues in AI analysis.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants