-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Check object depth limit at parse time #90285
Conversation
Pinging @elastic/es-search (Team:Search) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Maybe worth adding a test to check that this doesn't trip when we have a multiple-dotted field name underneath an object mapper with subobjects=false
?
It trips this check (while it does not trip the field limit layer when the mapping is validated on the master. I'm not sure why though.). Not sure if this is a dealbreaker or not. @javanna thoughts? EDIT: found out why this does not trigger on the master (there we only check objectmappers). Still, the problem remains that we can't detect in |
OK, figured it out now, pushing a fix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, one suggested change but good otherwise. No need for a further review.
server/src/main/java/org/elasticsearch/index/mapper/MappingLookup.java
Outdated
Show resolved
Hide resolved
Thanks @romseygeek! |
Parsing a hugely nested mapping can lead to stack overflow errors. This PR introduces a protection against this by tracking the depth level while parsing a object in the mapping, and throwing an error if the max depth level is exceeded. Currently we do have a protection against super deep object introduced in elastic#90285. But this protection is happening during dynamic mapping update, when the mapping is already parsed. To avoid stack overflow during parsing, we need this change as well. Closes elastic#52098
Parsing a hugely nested mapping can lead to stack overflow errors. This PR introduces a protection against this by tracking the depth level while parsing a object in the mapping, and throwing an error if the max depth level is exceeded. To do this, we use a new mappingParserContext object to parse every new mapping, and not reuse the same mappingParserContext. Currently we do have a protection against super deep object introduced in #90285. But this protection is happening during dynamic mapping update, when the mapping is already parsed. To avoid stack overflow during parsing, we need this change as well. Closes #52098
Helps avoiding stack overflow errors when the total field limit is set too high.
Relates #87926