TA-4861: check zip file before passing to axios#316
Merged
Kastriot Salihu (ksalihu) merged 1 commit intomasterfrom Mar 10, 2026
Conversation
Laberion Ajvazi (LaberionAjvazi)
approved these changes
Mar 6, 2026
Zgjim Haziri (ZgjimHaziri)
approved these changes
Mar 6, 2026
Buqeta (Buqeta)
approved these changes
Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When a zip file's total uncompressed size exceeds Node.js's 4 GB Buffer limit, adm-zip's toBuffer() throws an unhandled ERR_OUT_OF_RANGE crash. This can be triggered by a zip bomb — a file that is tiny on disk but expands to many gigabytes.
The fix adds an early check in buildBodyForImport that sums the uncompressed size of all entries (from the zip's local file headers) before attempting to buffer the zip. If the total exceeds 4 GB, a clear error is thrown: Failed to handle zip file "...": uncompressed size X.XX GB exceeds the 4 GB limit. A test case is included that simulates a zip bomb by injecting an entry reporting 5 GB of uncompressed data into an otherwise tiny zip.
Relevant links
Checklist