The vulnerability is a classic 'zip bomb' issue within the safe_extract function in guarddog/utils/archives.py. The function's logic for handling ZIP files (elif zipfile.is_zipfile(source_archive):) did not validate the potential size of the data before decompression. An attacker could craft a small, malicious ZIP file that, upon extraction, would fill up the disk, causing a Denial of Service. This is particularly dangerous in automated environments like CI/CD pipelines where a malicious package could halt all operations.
The patch, identified by commit c3fb07b4838945f42497e78b7a02bcfb1e63969b, rectifies this by introducing pre-extraction checks. It adds a _check_compression_bomb function that verifies three critical aspects: the total number of files, the total uncompressed size, and the compression ratio. These checks are performed before any files are written to disk. If any of the defined safety limits (MAX_FILE_COUNT, MAX_UNCOMPRESSED_SIZE, MAX_COMPRESSION_RATIO) are exceeded, the function now raises a ValueError, effectively neutralizing the zip bomb before it can cause harm. The vulnerable function is clearly safe_extract as it contained the flawed logic that was replaced by the patch.