mirror of
https://github.com/discourse/discourse.git
synced 2026-08-06 12:09:27 +08:00
Backport of #41725 to release/2026.1. --- 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> |
||
|---|---|---|
| .. | ||
| controllers/chat | ||
| jobs | ||
| models | ||
| queries/chat | ||
| serializers/chat | ||
| services/chat | ||
| validators/chat | ||
| views | ||