Skip to content

zip protection to zip converter#2050

Open
blackheart-5 wants to merge 3 commits into
microsoft:mainfrom
blackheart-5:main
Open

zip protection to zip converter#2050
blackheart-5 wants to merge 3 commits into
microsoft:mainfrom
blackheart-5:main

Conversation

@blackheart-5
Copy link
Copy Markdown

Problem

ZipConverter had no protection against zip bombs. A maliciously crafted
zip could cause OOM or infinite recursion if these exist:

  • High compression ratio (small zip → massive uncompressed size)
  • Millions of tiny files
  • Deeply nested zips (zip inside zip inside zip...)

Changes

  • Added ZIP_UNCOMPRESSED_SIZE_THRESHOLD = 100 MB — rejects zips whose
    total uncompressed size exceeds limit
  • Added MAX_FILE_COUNT = 1000 — rejects zips with too many files
  • Added MAX_DEPTH = 3 — rejects zips nested deeper than 3 levels
  • Depth counter passed through convert_stream recursively

Testing

Manually verified with normal zips and simulated oversized inputs.

@blackheart-5
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@blackheart-5 blackheart-5 changed the title zip protection to zip coonverter zip protection to zip converter Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants