0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-08 13:25:19 +08:00
discourse/plugins/chat/spec/services
discoursebot 4419578406
SECURITY: Enforce chat message length before cooking it [backport 2026.6] (#41751)
Backport of #41725 to release/2026.6.

---

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.

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
2026-07-16 11:10:19 +08:00
..
actions DEV: Replace Ruby numbered parameters by it where applicable (#37810) 2026-02-13 13:59:07 +01:00
chat SECURITY: Enforce chat message length before cooking it [backport 2026.6] (#41751) 2026-07-16 11:10:19 +08:00
video_conversion DEV: Add video conversion support for chat messages (#36275) 2025-12-01 12:34:56 -07:00
hashtag_autocomplete_service_spec.rb DEV: Chat hashtag test (#25638) 2024-02-12 12:32:52 +10:00