The GitHub Actions job "Pull Requests" on pekko.git/limit17 has succeeded.
Run started by GitHub user pjfanning (triggered by pjfanning).

Head commit for run:
6ff0d0b7f9ee5bcb1140c4070d4b3bb6a1631a28 / PJ Fanning 
<[email protected]>
fix: bound the size a compressed payload may expand to (#3502)

* fix: bound the size a compressed payload may expand to

Motivation:
Five serializers gzip their payload and decompress it on the way back in,
each with the same unbounded loop: read the whole GZIPInputStream into a
ByteArrayOutputStream. gzip expands by up to about three orders of
magnitude, so neither the size of the compressed bytes nor the transport's
frame limit bounds the buffer the decompressed bytes are read into.

Modification:
Add Decompression (@InternalApi) with a gunzip that stops once the
decompressed size passes pekko.serialization.max-decompressed-size
(default 256 MiB) and reports it as a NotSerializableException, and route
all twelve call sites through it. The Jackson serializers already bound
decompression and keep their own
pekko.serialization.jackson.compression.max-decompressed-size.

Result:
An over-expanding payload is rejected as an ordinary serialization
failure. No behaviour change for payloads within the limit.

* change the default max-decompressed-size to unlimited

Motivation:
A bounded default could reject a payload an existing cluster legitimately
exchanges, so a patch release carrying a 256 MiB default could break
running clusters on upgrade. The bound should be opt-in.

Modification:
Default pekko.serialization.max-decompressed-size to -1, meaning no limit
and matching the behaviour of earlier releases. A negative maximum skips
the size check in gunzip. Config's getBytes refuses negative numbers, so
the setting is read as a plain long first and as a memory size only when
that is not a negative number.

Result:
Decompression is unbounded by default; configuring a size such as 256 MiB
bounds it.

Tests:
- sbt "actor-tests/testOnly org.apache.pekko.serialization.DecompressionSpec" - 
8 passed
- sbt "cluster/testOnly 
org.apache.pekko.cluster.protobuf.ClusterMessageSerializerDecompressionSpec" - 
4 passed
- sbt "distributed-data/testOnly 
org.apache.pekko.cluster.ddata.protobuf.SerializationSupportDecompressionSpec" 
- 3 passed
- sbt "actor/scalafmtCheckAll" "actor-tests/scalafmtCheckAll" - clean

References:
Refs #3502

* also accept "unlimited" for max-decompressed-size

Motivation:
Review on #3515 noted that an explicit keyword is clearer than a magic
number. Keep the two sibling settings consistent: accept both spellings
here as well.

Modification:
pekko.serialization.max-decompressed-size reads "unlimited" or any
negative number as no limit; the reference.conf default is written as
`unlimited`. New tests cover the keyword default and an explicit -1.

Result:
`max-decompressed-size = unlimited` and `= -1` both disable the bound.

Tests:
- sbt "actor-tests/testOnly org.apache.pekko.serialization.DecompressionSpec" - 
9 passed
- sbt "actor/scalafmtCheckAll" "actor-tests/scalafmtCheckAll" - clean

References:
Refs #3515, Refs #3502

Report URL: https://github.com/apache/pekko/actions/runs/33859251035

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to