Skip to content

Archive / ZIP upload security

Archives deserve their own controls. The same route that safely accepts a JPEG can become a resource-exhaustion problem the moment it accepts ZIP.

  • Limit entry count.
  • Limit total uncompressed bytes.
  • Limit nesting depth.
  • Reject traversal-style paths.
import { composeScanners, createZipBombGuard, CommonHeuristicsScanner } from 'pompelmi';
const scanner = composeScanners(
[
['zipGuard', createZipBombGuard()],
['heuristics', CommonHeuristicsScanner],
],
{ stopOn: 'suspicious' }
);