Skip to content

[Backport 3.9] [Enhancement] Raise default structural limits for deserialization filter (#5826) - #5862

Merged
RyanL1997 merged 1 commit into
opensearch-project:3.9from
RyanL1997:backport/backport-5826-to-3.9
Oct 12, 2026
Merged

RyanL1997 merged 1 commit into
opensearch-project:3.9from
RyanL1997:backport/backport-5826-to-3.9

Conversation

@RyanL1997

Copy link
Copy Markdown
Collaborator

Description

Backport of #5826 to 3.9. #5721, which added these limits, is already on 3.9, so this only raises the defaults:

Setting Current default New default
plugins.query.deserialization.max_depth 20 150
plugins.query.deserialization.max_refs 1000 10000
plugins.query.deserialization.max_bytes 15000 65536

It also documents the settings and adds the regression tests from #5826. See #5826 for how the defaults were sized.

The code and test changes cherry-pick cleanly and match #5826 exactly. The only conflict was in docs/user/admin/settings.rst, where 3.9 has the plugins.query.partial_result.on_mapping_conflict.enabled section at the same location. I kept that section and added the new one right after it, before plugins.query.buckets, which is where it sits on main.

Related Issues

Backport of #5826

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • Commits are signed per the DCO using --signoff.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

…rialization filter (opensearch-project#5826)

Raise the deserialization filter defaults to max_depth=150,
max_refs=10000, max_bytes=65536, document the settings, and add
regression tests.

(cherry picked from commit 803ed31)
Signed-off-by: Jialiang Liang <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

PR Code Analyzer ❗

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

PathLineSeverityDescription
core/src/main/java/org/opensearch/sql/utils/DeserializationFilterUtil.java78mediumJava deserialization filter limits are significantly relaxed: MAX_DEPTH 20→150 (7.5×), MAX_REFS 1000→10000 (10×), MAX_BYTES 15000→65536 (4.4×). These controls defend against Java deserialization attacks (resource exhaustion, gadget-chain exploitation). The change is accompanied by detailed justification and tests that demonstrate the new limits still reject pathological inputs before stack overflow, suggesting legitimate intent to fix overly restrictive defaults. Maintainers should verify the cited measurements (max real-world depth of 72, script size cap of 65535 bytes) hold for their deployment and that no known gadget chains can be triggered within the expanded limits against the class allowlist in use.

The table above displays the top 10 most important findings.

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


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.

@github-actions

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@github-actions

Copy link
Copy Markdown
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Verify inclusive boundary condition handling

The test verifies that values exactly at the limit are accepted, but the filter
implementation may use strict inequality checks (>) instead of inclusive checks
(>=). Verify that the filter implementation uses inclusive comparisons to ensure
boundary values are properly accepted.

core/src/test/java/org/opensearch/sql/utils/DeserializationFilterUtilTest.java [59]

+// Verify filter uses >= comparisons for inclusive limits
 filter.checkInput(info(/*class*/ null, /*depth*/ 150, /*refs*/ 10000, /*bytes*/ 65536)));
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies that the test assumes inclusive boundary behavior and asks to verify the filter implementation matches this assumption. However, this is a verification request rather than identifying an actual bug in the PR code, and the test itself appears correctly written to validate the expected inclusive behavior.

Medium

@codecov

codecov Bot commented Oct 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.86%. Comparing base (bb7514f) to head (46529b0).

❌ Your project check has failed because the head coverage (62.86%) is below the target coverage (99.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff            @@
##                3.9    #5862   +/-   ##
=========================================
  Coverage     62.86%   62.86%           
  Complexity     8782     8782           
=========================================
  Files           938      938           
  Lines         40145    40145           
  Branches       4519     4519           
=========================================
  Hits          25238    25238           
  Misses        14106    14106           
  Partials        801      801           
Flag Coverage Δ
sql-engine 62.86% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@RyanL1997 RyanL1997 added the enhancement New feature or request label Oct 12, 2026
@RyanL1997
RyanL1997 merged commit 1a5ab59 into opensearch-project:3.9 Oct 12, 2026
44 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants