mirror of
https://github.com/docker/docker-agent.git
synced 2026-11-06 15:07:58 +00:00
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.