Repository navigation
gh-161945: reject zipfile compression mismatches - #161948
Conversation
|
NB I'd suggest backporting this to all non-EOL versions. It should be low risk as real, non-malicous ZIP encoders never mismatch the compression fields like this. |
A ZIP archive has two distinct compression fields for each member (central directory and local file). The `zipfile` module now rejects an archive where a member's compression fields do not match. Signed-off-by: William Woodruff <[email protected]>
8cdc5e2 to
ce04c37
Compare
carljm
left a comment
There was a problem hiding this comment.
Looks good! PR description should be clarified to use wording more like the NEWS entry: the archive is not rejected, opening the individual member is rejected.
Should this same fix be extended to zipimport._get_data()? It seems like even after this PR, it still trusts the central directory's compression field.
|
Thanks @carljm! I'll update the PR desc in a sec.
Past security triage of |
|
Thanks @woodruffw for the PR, and @carljm for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
|
Thanks @woodruffw for the PR, and @carljm for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15. |
|
GH-162489 is a backport of this pull request to the 3.14 branch. |
|
GH-162490 is a backport of this pull request to the 3.15 branch. |
…162489) gh-161945: reject zipfile compression mismatches (GH-161948) `ZipFile.open` now rejects a ZIP archive member whose compression fields (across the local file entry and central directory entry) disagree. (cherry picked from commit a46c65c) Signed-off-by: William Woodruff <[email protected]> Co-authored-by: William Woodruff <[email protected]>
…162490) gh-161945: reject zipfile compression mismatches (GH-161948) `ZipFile.open` now rejects a ZIP archive member whose compression fields (across the local file entry and central directory entry) disagree. (cherry picked from commit a46c65c) Signed-off-by: William Woodruff <[email protected]> Co-authored-by: William Woodruff <[email protected]>
ZipFile.opennow rejects a ZIP archive member whose compression fields (across the local file entry and central directory entry) disagree.Signed-off-by: William Woodruff [email protected]