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), )