{"record":{"id":"35c843a977ceb6c9","repo":"langchain-ai/deepagents","slug":"name-zip-entry-compression-ratio-exceeds-limit","errorCode":null,"errorMessage":"{name}: zip entry compression ratio exceeds limit","messagePattern":"(.+?): zip entry compression ratio exceeds limit","errorType":"error_code","errorClass":"FleetImportError","httpStatus":null,"severity":"error","filePath":"libs/talon/deepagents_talon/fleet_import.py","lineNumber":265,"sourceCode":"        or windows.drive != \"\"\n        or any(part in {\"\", \".\", \"..\"} for part in posix.parts)\n    )\n\n\ndef _is_symlink(info: zipfile.ZipInfo) -> bool:\n    file_type = (info.external_attr >> 16) & _ZIP_FILE_TYPE_MASK\n    return file_type == _ZIP_SYMLINK_TYPE\n\n\ndef _validate_zip_entry_size(name: str, info: zipfile.ZipInfo) -> None:\n    if info.file_size > _MAX_ZIP_UNCOMPRESSED_BYTES:\n        msg = f\"{name}: zip entry uncompressed size exceeds limit\"\n        raise FleetImportError(msg)\n    if info.compress_size == 0:\n        return\n    if info.file_size > info.compress_size * _MAX_ZIP_COMPRESSION_RATIO:\n        msg = f\"{name}: zip entry compression ratio exceeds limit\"\n        raise FleetImportError(msg)\n\n\ndef _materialize_staging(\n    archive: zipfile.ZipFile,\n    entries: Mapping[str, zipfile.ZipInfo],\n    staging: Path,\n) -> None:\n    _copy_zip_file(archive, entries[\"AGENTS.md\"], staging / \"AGENTS.md\")\n\n    for name, info in entries.items():\n        if name.startswith(\"skills/\"):\n            _copy_zip_file(archive, info, staging / name)\n        elif _is_subagent_prompt_path(name):\n            subagent = PurePosixPath(name).parts[1]\n            _validate_agent_name(subagent, name)\n            _copy_zip_file(archive, info, staging / \"agents\" / subagent / \"AGENTS.md\")\n        elif name in {\"config.json\", \"tools.json\"}:\n            _copy_zip_file(archive, info, staging / name)","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/talon/deepagents_talon/fleet_import.py#L247-L283","documentation":"A zip entry's declared uncompressed size exceeds its compressed size by more than `_MAX_ZIP_COMPRESSION_RATIO` (100x). This heuristic flags classic zip bombs — highly compressible payloads designed to explode during extraction — even when each entry is under the absolute size cap.","triggerScenarios":"`import_fleet_zip` sees an entry with `info.file_size > info.compress_size * 100` (entries with `compress_size == 0` skip this check).","commonSituations":"Hand-crafted zip bombs, archives containing long runs of zeros (sparse backups, dumps) that legitimately compress >100x, or corrupted headers declaring inflated sizes.","solutions":["Inspect the entry's compress/file size ratio; if it is legitimate data (e.g. zeros, repeated text), store it uncompressed (`zip -0`) or split it","Rebuild the export excluding the offending file; keep normal assets in the archive","Verify archive integrity (`zipfile.ZipFile(p).testzip()`) to rule out corruption","If you truly need to import such data, do it outside `import_fleet_zip` via direct file placement"],"exampleFix":"# before: 300 MB of zeros compressing to ~300 KB (ratio 1000x)\n# after: ship pre-compressed asset uncompressed in zip\nzip -0 fleet.zip skills/dump/zeros.bin  # or exclude the file","handlingStrategy":"validation","validationCode":"import zipfile\n\nRATIO = 100\n\ndef has_suspicious_ratio(path):\n    with zipfile.ZipFile(path) as z:\n        for zi in z.infolist():\n            if zi.compress_size and zi.file_size > zi.compress_size * RATIO:\n                return True\n    return False","typeGuard":null,"tryCatchPattern":"try:\n    import_fleet_zip(zip_path, target_dir=target)\nexcept FleetImportError as exc:\n    if \"compression ratio exceeds limit\" in str(exc):\n        print(\"Archive looks like a zip bomb; verify or store the entry uncompressed\")\n    raise","preventionTips":["Only import archives from trusted sources","Store legitimately high-compression data uncompressed (`zip -0`)","Run zipfile.testzip() to detect corruption"],"tags":["security","zip","zip-bomb","compression"],"backgroundTag":"zip-bomb-detected","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}