-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Fix SnapshotInfo.fromXContentInternal not Fully Consuming Parser #73268
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
Fix SnapshotInfo.fromXContentInternal not Fully Consuming Parser #73268
Conversation
The parsing here was causing trouble with the new streaming deserialization because it did not fully consume the parser so if the internal buffer of the parser was just enough to finish reading the `"snapshot"` field but missed the closing bracket, then the stream behind the parser would not have been consumed fully. Also it was strangely lenient and would just read a broken in-progress `SnapshotInfo` if it ran into SMILE that contained any object field under any key that isn't "snapshot". I made it a little stricter now to enforce that we have a "snapshot" field and not just an object field by any name.
|
Pinging @elastic/es-distributed (Team:Distributed) |
| parser.nextToken(); | ||
| } | ||
| XContentParser.Token token; | ||
| XContentParserUtils.ensureFieldName(parser, parser.currentToken(), SNAPSHOT); |
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.
kind of non-nonsensical to wrap in a "snapshot" field here to begin with I guess but that's a topic for another day I guess
DaveCTurner
left a comment
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, taking it on trust that we never deliberately put things other than a snapshot top-level field in these blobs.
|
Thanks David!
I don't know of version of ES that would have done that (that would have broken the snapshot estimator for sure and we have tests literally taking snapshots from every ES version supported on Cloud for that thing). |
Similar to elastic#73268 we should be stricter here, especially when we are super-strict about additional fields anyway. Also, use our parser exception utils to get better exceptions if parsing fails.
…stic#73268) The parsing here was causing trouble with the new streaming deserialization because it did not fully consume the parser so if the internal buffer of the parser was just enough to finish reading the `"snapshot"` field but missed the closing bracket, then the stream behind the parser would not have been consumed fully. Also it was strangely lenient and would just read a broken in-progress `SnapshotInfo` if it ran into SMILE that contained any object field under any key that isn't "snapshot". I made it a little stricter now to enforce that we have a "snapshot" field and not just an object field by any name.
) (#73274) The parsing here was causing trouble with the new streaming deserialization because it did not fully consume the parser so if the internal buffer of the parser was just enough to finish reading the `"snapshot"` field but missed the closing bracket, then the stream behind the parser would not have been consumed fully. Also it was strangely lenient and would just read a broken in-progress `SnapshotInfo` if it ran into SMILE that contained any object field under any key that isn't "snapshot". I made it a little stricter now to enforce that we have a "snapshot" field and not just an object field by any name.
Similar to #73268 we should be stricter here, especially when we are super-strict about additional fields anyway. Also, use our parser exception utils to get better exceptions if parsing fails.
Similar to elastic#73268 we should be stricter here, especially when we are super-strict about additional fields anyway. Also, use our parser exception utils to get better exceptions if parsing fails.
Exactly the same as elastic#73268 but for metadata and index metadata which can run into the same bug.
…lastic#74844) Exactly the same as elastic#73268 but for metadata and index metadata which can run into the same bug.
…lastic#74844) Exactly the same as elastic#73268 but for metadata and index metadata which can run into the same bug.
The parsing here was causing trouble with the new streaming deserialization because it
did not fully consume the parser so if the internal buffer of the parser was just enough
to finish reading the
"snapshot"field but missed the closing bracket, then the stream behindthe parser would not have been consumed fully. Also it was strangely lenient and would just read
a broken in-progress
SnapshotInfoif it ran into SMILE that contained any object fieldunder any key that isn't "snapshot". I made it a little stricter now to enforce that
we have a "snapshot" field and not just an object field by any name.