Skip to content

TA-4861: check zip file before passing to axios#316

Merged
Kastriot Salihu (ksalihu) merged 1 commit intomasterfrom
ksalihu/TA-4861-unhandled-error-when-zip-bombs-are-used-in-content-cli
Mar 10, 2026
Merged

TA-4861: check zip file before passing to axios#316
Kastriot Salihu (ksalihu) merged 1 commit intomasterfrom
ksalihu/TA-4861-unhandled-error-when-zip-bombs-are-used-in-content-cli

Conversation

@ksalihu
Copy link
Contributor

@ksalihu Kastriot Salihu (ksalihu) commented Mar 6, 2026

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

  • I have self-reviewed this PR
  • I have tested the change and proved that it works in different scenarios
  • I have updated docs if needed

@ksalihu Kastriot Salihu (ksalihu) requested a review from a team as a code owner March 6, 2026 10:50
@ksalihu Kastriot Salihu (ksalihu) merged commit 72f2287 into master Mar 10, 2026
3 of 4 checks passed
@ksalihu Kastriot Salihu (ksalihu) deleted the ksalihu/TA-4861-unhandled-error-when-zip-bombs-are-used-in-content-cli branch March 10, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants