From 3dd5ce236a7b05d77093af2752222e55333f9ea0 Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Sun, 5 Jul 2026 15:00:32 -0700 Subject: [PATCH] fix(sms): set client_max_size on the Twilio webhook Application Follow-up to the salvaged #54620: the post-read length check bounds processing but a chunked body is still buffered by aiohttp first. client_max_size enforces the same 64 KiB cap mid-read on every path (#58536/#58902/#59180 pattern). --- plugins/platforms/sms/adapter.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/platforms/sms/adapter.py b/plugins/platforms/sms/adapter.py index 1646b1b5956..04bf8e2a864 100644 --- a/plugins/platforms/sms/adapter.py +++ b/plugins/platforms/sms/adapter.py @@ -119,7 +119,10 @@ class SmsAdapter(BasePlatformAdapter): self._webhook_port, ) - app = web.Application() + # client_max_size bounds every read path — including chunked bodies + # with no Content-Length — before the handler's own 413 checks run + # (#58536/#58902/#59180 pattern). + app = web.Application(client_max_size=_TWILIO_WEBHOOK_MAX_BODY_BYTES) app.router.add_post("/webhooks/twilio", self._handle_webhook) app.router.add_get("/health", lambda _: web.Response(text="ok"))