Skip to content

Commit c5a6723

Browse files
miss-islingtonkrnick
authored andcommitted
bpo-36260: Add pitfalls to zipfile module documentation (GH-13378) (GH-15976)
* bpo-36260: Add pitfalls to zipfile module documentation We saw vulnerability warning description (including zip bomb) in Doc/library/xml.rst file. This gave us the idea of documentation improvement. So, we moved a little bit forward :P And the doc patch can be found (pr). * fix trailing whitespace * 📜🤖 Added by blurb_it. * Reformat text for consistency. (cherry picked from commit 3ba51d5) Co-authored-by: JunWei Song <sungboss2004@gmail.com>
1 parent 436cd2c commit c5a6723

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

Doc/library/zipfile.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,5 +816,45 @@ Command-line options
816816

817817
Test whether the zipfile is valid or not.
818818

819+
Decompression pitfalls
820+
----------------------
821+
822+
The extraction in zipfile module might fail due to some pitfalls listed below.
823+
824+
From file itself
825+
~~~~~~~~~~~~~~~~
826+
827+
Decompression may fail due to incorrect password / CRC checksum / ZIP format or
828+
unsupported compression method / decryption.
829+
830+
File System limitations
831+
~~~~~~~~~~~~~~~~~~~~~~~
832+
833+
Exceeding limitations on different file systems can cause decompression failed.
834+
Such as allowable characters in the directory entries, length of the file name,
835+
length of the pathname, size of a single file, and number of files, etc.
836+
837+
Resources limitations
838+
~~~~~~~~~~~~~~~~~~~~~
839+
840+
The lack of memory or disk volume would lead to decompression
841+
failed. For example, decompression bombs (aka `ZIP bomb`_)
842+
apply to zipfile library that can cause disk volume exhaustion.
843+
844+
Interruption
845+
~~~~~~~~~~~~
846+
847+
Interruption during the decompression, such as pressing control-C or killing the
848+
decompression process may result in incomplete decompression of the archive.
849+
850+
Default behaviors of extraction
851+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
852+
853+
Not knowing the default extraction behaviors
854+
can cause unexpected decompression results.
855+
For example, when extracting the same archive twice,
856+
it overwrites files without asking.
857+
819858

859+
.. _ZIP bomb: https://en.wikipedia.org/wiki/Zip_bomb
820860
.. _PKZIP Application Note: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add decompression pitfalls to zipfile module documentation.

0 commit comments

Comments
 (0)