I believe that the remedy for adm_zip incorrectly targets high compression ratios. It’s valid and common for compression ratios to be high for highly compressible files, well over the specified THRESHOLD_RATIO of 10 (compression levels only run from 1 - 9 for the zip protocol, but ratios are dynamic).
This blocked valid and innocuous zip files for us.
let compressionRatio = entrySize / zipEntry.header.compressedSize;
if (compressionRatio > THRESHOLD_RATIO) {
throw 'Reached max. compression ratio';
}
The file size check provides adequate protection against disk. I’m not sure if this check was meant to protect against cpu. If so, then I think a combination of file size and compression ratio would be necessary but might have to be determined heuristically.
I have not reviewed suggestions for the other zip libraries, only adm_zip, but the same might apply.
I’m new to SonarQube, have used the lint rules for years but only recently the security rules. I’m not sure if this is the correct place to report such issues.