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

Make msearch line format less lenient #61771

Closed
cbuescher opened this issue Sep 1, 2020 · 5 comments · Fixed by #103232
Closed

Make msearch line format less lenient #61771

cbuescher opened this issue Sep 1, 2020 · 5 comments · Fixed by #103232
Labels
>enhancement good first issue low hanging fruit :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team v7.9.4 v8.13.0

Comments

@cbuescher
Copy link
Member

A user recently discovered that we allow training closing brackets in _msearch request lines (see #61353).
It seems we parse only the first complete JSON object to a map, then discarding the rest of the line in MultiSearchRequest#readMultiLineFormat, allowing requests like the following:

GET my-index/_msearch
{"index": "my-index"}}}}
{"query" : {"match_all" : {}}}}}}
{"index": "my-index"}{ "this is" : "ignored as well"}
{"query" : {"match_all" : {}}}

While this is just a leniency that shouldn't affect the correct behaviour of the search, maybe we shouldn't allow this and error if we detect anything after parsing the initial json object.

@cbuescher cbuescher added >enhancement :Search/Search Search-related issues that do not fall into other categories v8.0.0 v7.9.2 labels Sep 1, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/Search)

@elasticmachine elasticmachine added the Team:Search Meta label for search team label Sep 1, 2020
@danhermann danhermann added v7.9.3 and removed v7.9.2 labels Sep 18, 2020
@matriv matriv added v7.9.4 and removed v7.9.3 labels Oct 16, 2020
@arteam arteam added v8.1.0 and removed v8.0.0 labels Jan 12, 2022
@mark-vieira mark-vieira added v8.2.0 and removed v8.1.0 labels Feb 2, 2022
@mark-vieira mark-vieira added v8.5.0 and removed v8.4.0 labels Jul 27, 2022
@csoulios csoulios added v8.6.0 and removed v8.5.0 labels Sep 21, 2022
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

@cbuescher cbuescher self-assigned this Sep 22, 2022
@kingherc kingherc added v8.7.0 and removed v8.6.0 labels Nov 16, 2022
@rjernst rjernst added v8.8.0 and removed v8.7.0 labels Feb 8, 2023
@gmarouli gmarouli added v8.9.0 and removed v8.8.0 labels Apr 26, 2023
@javanna javanna added the good first issue low hanging fruit label May 3, 2023
@cbuescher cbuescher removed their assignment May 12, 2023
@pranutyagi
Copy link

Hi, I am a first timer and want to work on this issue, can you please give more details on how to raise a pull request?

@Utsavk
Copy link

Utsavk commented Jul 22, 2023

Hi @cbuescher , Can I give it try? It will be my first contribution.

@quux00 quux00 added v8.11.0 and removed v8.10.0 labels Aug 16, 2023
@mattc58 mattc58 added v8.12.0 and removed v8.11.0 labels Oct 4, 2023
@sujaysamanta
Copy link

Hello team,
This is my first time here and I want to contribute, is this issue still available to be picked up ..?

limotova added a commit to limotova/elasticsearch that referenced this issue Dec 9, 2023
Extra characters after msearch request lines are currently ignored. This
commit adds a check for extra chars and throws an exception if found.

Fixes elastic#61771
benwtrent added a commit that referenced this issue Jan 4, 2024
* Remove leniency in msearch parsing (#61771)

Extra characters after msearch request lines are currently ignored. This
commit adds a check for extra chars and throws an exception if found.

Fixes #61771

* adding changelog entry

* Fix test

---------

Co-authored-by: Elastic Machine <[email protected]>
Co-authored-by: Benjamin Trent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement good first issue low hanging fruit :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team v7.9.4 v8.13.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.