-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 session corruption #45786
Merged
Merged
fix session corruption #45786
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
added
audit-log
Issues related to Teleports Audit Log
size/md
labels
Aug 23, 2024
fspmarshall
force-pushed
the
fspmarshall/fix-session-corruption
branch
from
August 23, 2024 20:02
56d3d6e
to
b8afff0
Compare
ravicious
approved these changes
Aug 26, 2024
fspmarshall
force-pushed
the
fspmarshall/fix-session-corruption
branch
3 times, most recently
from
August 26, 2024 15:37
c76b0ef
to
4d5631f
Compare
/excludeflake * |
rosstimothy
approved these changes
Aug 28, 2024
public-teleport-github-review-bot
bot
removed the request for review
from camscale
August 28, 2024 14:48
fspmarshall
force-pushed
the
fspmarshall/fix-session-corruption
branch
from
August 28, 2024 16:42
88231e1
to
1590d87
Compare
github-merge-queue
bot
removed this pull request from the merge queue due to failed status checks
Aug 28, 2024
github-merge-queue
bot
removed this pull request from the merge queue due to failed status checks
Aug 28, 2024
@fspmarshall See the table below for backport results.
|
This was referenced Aug 29, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
audit-log
Issues related to Teleports Audit Log
backport/branch/v14
backport/branch/v15
backport/branch/v16
size/md
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes an issue where session recording could become corrupted during multipart upload if two conditions were met simultaneously:
In this case, the slice would have its
reader()
method called multiple times. Thereader()
method determines the length of the slice based on the length of the underlying buffer and appends padding as needed, noting the length of the payload and length of the padding in the slice header. On subsequent calls toreader()
this logic would be re-run and would count the padding bytes as part of the payload, resulting in corruption of the header and preventing the session recording from being read. Attempts to read the session recording would fail with the errorgzip: invalid header
.This PR updates the multipart upload logic to prevent this condition from being hit, and updates the session recording read logic to be able to read existing corrupted sessions. Test coverage has been added to catch future issues with paddings/retry conditions (neither of which were properly covered), and the test coverage has been added to the reader to ensure it can decode a fake corrupted session that was generated manually using some of our existing session recording test utilities (
lib/events/testdata/corrupted-session
).This issue is loosely related to #45877 as the two issues tend to happen together since they are both triggered when the session recording system is under extremely high load.
changelog: fixed an issue where attempts to play/export certain session recordings would fail with
gzip: invalid header
.