Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure jackson default maximums introduced in 2.16.0 do not conflict with OpenSearch settings #11278

Closed
cwperks opened this issue Nov 20, 2023 · 2 comments · Fixed by #11811
Closed
Assignees
Labels
enhancement Enhancement or improvement to existing feature or request v2.12.0 Issues and PRs related to version 2.12.0 v3.0.0 Issues and PRs related to version 3.0.0

Comments

@cwperks
Copy link
Member

cwperks commented Nov 20, 2023

In jackson 2.16.0 new settings were added to configure maximum nesting on output and maximum field length on input. OpenSearch already has 2 settings for similar behavior:

public static final Setting<Long> INDEX_MAPPING_DEPTH_LIMIT_SETTING = Setting.longSetting(
    "index.mapping.depth.limit",
    20L,
    1,
    Property.Dynamic,
    Property.IndexScope
);
public static final Setting<Long> INDEX_MAPPING_FIELD_NAME_LENGTH_LIMIT_SETTING = Setting.longSetting(
    "index.mapping.field_name_length.limit",
    Long.MAX_VALUE,
    1L,
    Property.Dynamic,
    Property.IndexScope
);

Its possible that a user could configure the OpenSearch settings with values that exceed the maximums from Jackson, in which case, the Jackson defaults would supersede the OpenSearch settings. I'm capturing an issue to track whether OpenSearch should allow a user to configure a cluster to exceed the Jackson maximums.

It may be possible to update the XContent Parsers to configure StreadReadConstraints and StreamWriteConstraints which is already configured for 50mb max document size: https://github.com/opensearch-project/OpenSearch/blob/main/libs/x-content/src/main/java/org/opensearch/common/xcontent/json/JsonXContent.java#L81

@reta
Copy link
Collaborator

reta commented Nov 20, 2023

We already have some system properties (fe opensearch.xcontent.string.length.max) to configure the XContent related limits (which directly translate to StreamReadConstraints on Jackson side). It will probably make sense to add system properties to control new 2.16.0 settings (#11273 (comment)) and make sure they do not conflict with the OpenSearch ones.

@reta reta added v2.12.0 Issues and PRs related to version 2.12.0 v3.0.0 Issues and PRs related to version 3.0.0 enhancement Enhancement or improvement to existing feature or request and removed untriaged bug Something isn't working labels Nov 20, 2023
@reta reta self-assigned this Nov 22, 2023
@reta
Copy link
Collaborator

reta commented Nov 30, 2023

Also potentially worth noting here: FasterXML/jackson-databind#3651

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement or improvement to existing feature or request v2.12.0 Issues and PRs related to version 2.12.0 v3.0.0 Issues and PRs related to version 3.0.0
Projects
None yet
2 participants