The vulnerability lies in the extractArchive function in src/infra/archive.ts, which is responsible for handling both TAR and ZIP file extraction. The advisory correctly points to this function. An analysis of the patch commits confirms that this function and its helper extractZip were missing crucial resource consumption limits.
The root cause of the vulnerability was the lack of validation on the contents of user-provided archives. Maliciously crafted TAR or ZIP files (e.g., "zip bombs") could contain a huge number of files or files that decompress to a very large size. The original code would attempt to extract these without any checks, leading to excessive consumption of CPU, memory (especially for ZIP files loaded into memory), and disk space, resulting in a denial of service.
The patch d3ee5deb87ee2ad0ab83c92c365611165423cb71 rectifies this by introducing a new ArchiveExtractLimits type and applying these limits within both extractArchive (for TARs) and extractZip. The new logic checks:
- The size of the compressed archive itself (for ZIPs).
- The total number of entries (files/directories) in the archive.
- The uncompressed size of each individual file.
- The total uncompressed size of all files combined.
If any of these limits are exceeded during extraction, the process is aborted, preventing the denial of service. The vulnerable functions are extractArchive and the internal extractZip because they contained the flawed logic that processed archives without these essential safeguards.