0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-11 02:59:07 +08:00
discourse/plugins/chat/spec/requests/chat
Alan Guo Xiang Tan f4a9c63667
SECURITY: Enforce chat message length before cooking it (#41725)
Chat::CreateMessage and Chat::UpdateMessage cooked the full,
attacker-controlled message (markdown-it rendering in V8) before the
chat_maximum_message_length limit was enforced at save!. A single
low-privilege request with an oversized body could burn tens of seconds
of worker CPU on rendering that was immediately discarded as too long,
enabling denial of service against the shared worker pool.

Validate the message length in the service contract, which runs before
the message is cooked, so oversized input is rejected without the
expensive rendering. The model-level length validation remains as
defense in depth. The guard covers the create, edit, and
Slack-compatible incoming-webhook paths, which all route through these
services.
2026-07-16 11:10:06 +08:00
..
admin DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
api SECURITY: Enforce chat message length before cooking it (#41725) 2026-07-16 11:10:06 +08:00
incoming_webhooks_controller_spec.rb SECURITY: Enforce chat message length before cooking it (#41725) 2026-07-16 11:10:06 +08:00