From af7a324eccaa29a540e9e3906c71825a8dc33114 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Fri, 6 Nov 2026 14:16:15 +0100 Subject: [PATCH] #77 - Documentation: decompression overhead of the max_size option of archive_unzip Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 1 + docs/reference/tasks/unzip_task.md | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e935db9..485033f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ Latest ------ ### Changes +* [#77](https://github.com/cleverage/archive-process-bundle/issues/77) Documentation: the `max_size` option of `archive_unzip` decompresses every entry once more to count the bytes, which makes the extraction about 77 % slower. Update documentation. * [#75](https://github.com/cleverage/archive-process-bundle/issues/75) Documentation: the `import_archive` cookbook uses the `form` option of cleverage/ui-process-bundle 3.5 instead of the deprecated `entrypoint_type` and `constraints` UI options. * [#73](https://github.com/cleverage/archive-process-bundle/issues/73) Documentation: the Flysystem storages of the `export_archive_upload` cookbook are configured with the format of league/flysystem-bundle 3.5 and later, the `adapter` / `options` format being deprecated since flysystem-bundle 3.5. diff --git a/docs/reference/tasks/unzip_task.md b/docs/reference/tasks/unzip_task.md index 588c578..61c69a4 100644 --- a/docs/reference/tasks/unzip_task.md +++ b/docs/reference/tasks/unzip_task.md @@ -37,7 +37,7 @@ Options | `filename` | `string` | **X** | | Path of the zip archive to extract. It must exist and be readable (`UnexpectedValueException`) | | `destination` | `string` | **X** | | Directory where the archive content is extracted | | `max_files` | `?int` | | `null` | Maximum number of entries of the archive (`null`: no limit) | -| `max_size` | `?int` | | `null` | Maximum total uncompressed size of the entries, in bytes (`null`: no limit) | +| `max_size` | `?int` | | `null` | Maximum total uncompressed size of the entries, in bytes (`null`: no limit). Every entry is decompressed once more to count its bytes, which makes the extraction about 77 % slower (see the notes) | `filename` and `destination` are required, but they can be provided either in the task configuration or in the input. They are validated when the task is executed, not at process initialization. @@ -91,5 +91,7 @@ Notes to protect the server against "zip bombs": they are checked before anything is extracted, and the task fails with a `RuntimeException` when a limit is exceeded. `max_size` is checked on the sizes declared in the central directory of the archive, then on the bytes actually decompressed from its entries (the declared sizes can be forged): the - archive is decompressed twice, up to `max_size` bytes, without writing anything before the extraction. An extraction failing + archive is decompressed twice, up to `max_size` bytes, without writing anything before the extraction. This extra + pass has a cost: the decompression time measured with `max_size` is about 77 % higher than without it. Set it for + untrusted archives only, and leave it to `null` (or rely on `max_files` alone) for archives you trust. An extraction failing for another reason (e.g. a write error) may leave the entries already extracted in the destination directory.