shashank created CAMEL-26089:
--------------------------------

             Summary: camel-zip-deflater - add the maxDecompressedSize option 
of zipFile and tarFile to the gzipDeflater and zipDeflater data formats
                 Key: CAMEL-26089
                 URL: https://issues.apache.org/jira/browse/CAMEL-26089
             Project: Camel
          Issue Type: Improvement
            Reporter: shashank
            Assignee: shashank


The Zip File and Tar File data formats limit how much data an unmarshal may 
decompress with {{maxDecompressedSize}} (default 1073741824 bytes = 1 GiB, 
{{-1}} for no limit, an {{IOException}} when it is exceeded). The 
{{gzipDeflater}} and {{zipDeflater}} data formats of camel-zip-deflater copy 
the whole decompressed stream with {{IOHelper.copy(InputStream, OutputStream)}} 
and have no such option (main 48f499f5e991, 
{{GzipDeflaterDataFormat.unmarshal}} and {{ZipDeflaterDataFormat.unmarshal}}).

*Proposal*: give both data formats the same option, with the same name, type, 
default (1 GiB) and semantics ({{-1}}, or any value of 0 or less, for no 
limit). Unmarshal copies through the bounded {{IOHelper.copy(InputStream, 
OutputStream, int, boolean, long)}} that {{ZipFileDataFormat}} uses, so an 
unmarshal over the limit fails with the same {{IOException}} ("The InputStream 
entry being copied exceeds the maximum allowed size"); the count is a {{long}}, 
so limits of 2 GiB or more work (CAMEL-25023). The option is added to the model 
({{GzipDeflaterDataFormat}}, {{ZipDeflaterDataFormat}} and their builders), the 
reifiers, and the generated XML/YAML DSL, schemas and catalog. Marshal is not 
changed.

*Behaviour change*: with the 1 GiB default, a message that decompresses to more 
than 1 GiB fails where it worked before. The limit counts the whole 
decompressed message: a {{.tar.gz}} unmarshalled with {{gzipDeflater}} and then 
split into its entries (the use case of CAMEL-16953) counts the whole tar 
archive, while the {{tarFile}} limit applies to each entry. Upgrade guide 4.24 
entry: set a higher limit or {{-1}}.

*Tests*: a new test in camel-zip-deflater: over the limit fails with the 
{{IOException}} and nothing reaches the route, at the limit and {{-1}} work, a 
limit of 4 GiB + 10 bytes is not cut to an int, the default is 1 GiB (exactly 1 
GiB passes, one byte more fails), and a limit over 2 GiB is enforced, with a 
generated stream (no data is held in memory).

_Filed with Claude Code on behalf of allthingssecurity._



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to