Skip to content

Commit 5a0289e

Browse files
miohtamaewdurbin
andauthored
Fix ZIP bomb threshold too low (#13967)
* Fix ZIP bomb threshold too low See #13962 * Update legacy.py Set threshold to 100x * Update warehouse/forklift/legacy.py --------- Co-authored-by: Ee Durbin <[email protected]>
1 parent b433314 commit 5a0289e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

warehouse/forklift/legacy.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,13 @@
8383
PATH_HASHER = "blake2_256"
8484

8585
COMPRESSION_RATIO_MIN_SIZE = 64 * ONE_MB
86-
COMPRESSION_RATIO_THRESHOLD = 10
86+
87+
# If the zip file decompressed to 50x more space
88+
# than it is uncompressed, consider it a ZIP bomb.
89+
# Note that packages containing interface descriptions, JSON,
90+
# such resources can compress really well.
91+
# See discussion here: https://github.com/pypi/warehouse/issues/13962
92+
COMPRESSION_RATIO_THRESHOLD = 50
8793

8894

8995
# Wheel platform checking

0 commit comments

Comments
 (0)