[release-5.29] Backport #2403 aka CVE-2024-3727#2415
Closed
dcermak wants to merge 6 commits into
Closed
Conversation
Signed-off-by: Miloslav Trmač <mitr@redhat.com> (cherry picked from commit b724ee7)
Use defer() to remove the temporary file, instead of duplicating the call. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com> (cherry picked from commit a802d65)
Use defer, a nested function, and early returns. Besides being a bit more directly related to what we want to achieve, this now does not call decompressed.Close() on a nil value if DecompressStream fails. Signed-off-by: Miloslav Trmač <mitr@redhat.com> (cherry picked from commit 4a3785d)
... to prevent unexpected behavior on invalid values. Signed-off-by: Miloslav Trmač <mitr@redhat.com> (cherry picked from commit a9225e4)
If doing it makes sense at all, it should happen before the values are used. Signed-off-by: Miloslav Trmač <mitr@redhat.com> (cherry picked from commit 2bcb834)
... to prevent panics if the value does not contain a :, or other unexpected values (e.g. a path traversal). Don't bother on paths where we computed the digest ourselves, or it is already trusted for other reasons. Signed-off-by: Miloslav Trmač <mitr@redhat.com> (cherry picked from commit 39e7c91)
Collaborator
|
Thanks so much for the backport! If you don’t mind, I’d prefer the variant in #2418 , where the commit order matches #2404 , making it easier to prove the two match; and the backport is ~1 line smaller. Either way, I’m very grateful for this PR, because it independently confirms the correctness of the backport. Alternatively, if you’d like to reorder/update this PR, I’d be happy to merge this one to preserve your credit in the git history. |
Contributor
Author
Nah, don't worry about it, you did 99% of the work, I just deleted some lines in git conflicts ;-) |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.