From 2bcb893d871593bf5a26efdd68c61871c0a6bc5d Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Sun, 5 Jul 2026 15:12:55 -0700 Subject: [PATCH] fix(feishu): set client_max_size on the webhook Application Follow-up to the salvaged #54938: the bounded reader gives a proper 413 + anomaly telemetry for oversized chunked bodies; client_max_size makes aiohttp enforce the same 1 MiB cap on every other read path (#58536/#58902/#59180 pattern). Test fixture's fake Application now accepts kwargs. --- plugins/platforms/feishu/adapter.py | 5 ++++- tests/gateway/test_feishu.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/platforms/feishu/adapter.py b/plugins/platforms/feishu/adapter.py index 90cea13f646..7dd7e238937 100644 --- a/plugins/platforms/feishu/adapter.py +++ b/plugins/platforms/feishu/adapter.py @@ -4747,7 +4747,10 @@ class FeishuAdapter(BasePlatformAdapter): if self._event_handler is None: raise RuntimeError("failed to build Feishu event handler") await self._hydrate_bot_identity() - app = web.Application() + # client_max_size backstops the bounded reader in + # _handle_webhook_request; aiohttp then enforces the same cap on + # every read path (#58536/#58902/#59180 pattern). + app = web.Application(client_max_size=_FEISHU_WEBHOOK_MAX_BODY_BYTES) app.router.add_post(self._webhook_path, self._handle_webhook_request) self._webhook_runner = web.AppRunner(app) await self._webhook_runner.setup() diff --git a/tests/gateway/test_feishu.py b/tests/gateway/test_feishu.py index 1d95008d9f4..58d7bb88872 100644 --- a/tests/gateway/test_feishu.py +++ b/tests/gateway/test_feishu.py @@ -190,7 +190,7 @@ class TestFeishuAdapterMessaging(unittest.TestCase): runner = AsyncMock() site = AsyncMock() web_module = SimpleNamespace( - Application=lambda: SimpleNamespace(router=SimpleNamespace(add_post=lambda *_args, **_kwargs: None)), + Application=lambda **_kwargs: SimpleNamespace(router=SimpleNamespace(add_post=lambda *_args, **_kwargs: None)), AppRunner=lambda _app: runner, TCPSite=lambda _runner, host, port: SimpleNamespace(start=site.start, host=host, port=port), )