gh-146581: Fix vulnerability in shutil.unpack_archive() for ZIP files on Windows#146591
gh-146581: Fix vulnerability in shutil.unpack_archive() for ZIP files on Windows#146591serhiy-storchaka wants to merge 6 commits intopython:mainfrom
Conversation
Use ZipFile.extractall() to sanitize file names and extract files. Files with invalid names (e.g. absolute paths) are now extracted with different names instead of been skipped or written out of the destination directory. Files containing ".." in the name are no longer skipped.
…ve-extractall' into shutil-unpack_archive-extractall
|
Wasn't |
|
Also, the new |
Backports will be fixed to use equivalent code.
Backslash is not a separator on Posix. It is a legal character which has no special meaning. |
|
I believe it’s actually a regression. Currently, In this PR it switches to a component based check, which removes that existing protection. So I believe this actually reduces the existing security strictness for non windows users |
Use ZipFile.extractall() to sanitize file names and extract files.
Files with invalid names (e.g. absolute paths) are now skipped.
Files containing ".." in the name are no longer skipped.