Description
Before v4.16.1, Echo v4's Decompress middleware does not impose its own limit on the decompressed request body size. A small gzip request may expand into a very large body on routes where this middleware is enabled.
Potential impact
Reading or binding the decompressed body may consume excessive CPU and memory. Limiting only the compressed request size does not limit the size after decompression.
Remediation
Update github.com/labstack/echo/v4 to v4.16.1 or later and set MaxDecompressedSize to a suitable value for the service. Be aware that -1 disables the limit. Until you can update, disable gzip request decompression on affected routes or apply an effective size limit to the decompressed body. Handle body-read errors as well.
Examples
The following examples show a dependency declaration in go.mod.
Before
require github.com/labstack/echo/v4 v4.16.0
After
require github.com/labstack/echo/v4 v4.16.1
Update go.sum, then rebuild and deploy using the fixed module.