Files
docker-agent/pkg/runtime/wire
David Gageot 43fa298f7f feat(runtime/wire): cap request bodies with http.MaxBytesReader
Unbounded JSON decoding is a textbook DoS vector: a single misbehaving
or malicious client can stream gigabytes into json.Decoder and pin
server memory. With the scaffold still in-process the risk is
theoretical, but the cap belongs in the same change as the handler so
it cannot be forgotten when the endpoint is exposed to a real network.

The cap is set at 1 MiB \u2014 orders of magnitude larger than the biggest
legitimate request today (CreateSessionRequest is a few dozen bytes),
yet small enough that an attacker cannot trivially exhaust memory. A
new test pins the contract: an over-cap body is rejected with a 4xx
and never reaches the backend.
2026-05-11 11:42:38 +02:00
..