aiocqhttp icon indicating copy to clipboard operation
aiocqhttp copied to clipboard

Feat on_websocket_receive

Open Ice9Coffee opened this issue 4 years ago • 3 comments

现有的hook函数无法在ws收到消息时,对不可信的OneBot进行验证。

添加on_websocket_receive接口,在每次调用websocket.receice()后、其他处理前调用钩子函数,可用于实现安全认证。

Ice9Coffee avatar Sep 07 '21 14:09 Ice9Coffee

有什麽特別的用處嗎;可信是什麽意思;ws 需要在每個 packet 中每次都發驗證信息嗎?

cleoold avatar Sep 14 '21 01:09 cleoold

有什麽特別的用處嗎;可信是什麽意思

之前咖啡佬跟我讨论了,这个作用在于当用 aiocqhttp 作为一个公开 OneBot 服务端时,可能会有恶意用户发来过长、过分复杂(导致 json.loads 失败/耗时)的消息,允许设置一个过滤函数,可以避免这种情况

stdrc avatar Sep 14 '21 01:09 stdrc

please rebase commits into one; 'fxxking' is annoying

cleoold avatar Sep 14 '21 01:09 cleoold