fix(rooms): cap room description + wiki body length like chat messages (LC-153-WIKI-DESC-CAP) #287
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/lc-153-wiki-desc-cap"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #283 (LC-153-WIKI-DESC-CAP). Room description and wiki bodies rendered through the markdown + LaTeX pipeline with no length bound - the only limit was Axum's ~2 MiB
DefaultBodyLimit, vs the 16K-char cap chat messages get (LC-153). A privileged-but-untrusted room moderator could feed a multi-MiB body to the renderer on every save and to every viewer on every page load.Fix
routes::room_info::patch_descriptionandpatch_wikinow reject a body overMAX_DOC_CHARS = 64_000chars before any DB write or render. Counted as characters (not bytes), matchingroom::check_message_length, so multibyte (CJK / emoji) docs are not penalized. 64K is generous for a wiki page and ~32x below the framework body limit.markdown::renderis synchronous and called inline on the request thread everywhere (the chat post path atroom.rs:1953/1962included; only the one-timewarm_syntectwarm-up isspawn_blocking-offloaded). Bounding the input is the mitigation and matches the established chat convention, so this stays consistent with every other markdown surface.Tests
over_long_wiki_rejected/over_long_description_rejected(64001 chars -> 400, nothing stored) andwiki_at_cap_accepted(64000 chars -> 200, stored; boundary is inclusive). 9/9 inroutes_room_info, passing in both standalone and saas.Docs
CLAUDE.md gains a "Markdown surfaces share a length cap" note (the M2 gotcha from the tech-debt sweep, folded into this ticket) so the next contributor adding a markdown-backed field caps it on the write handler.
No
[operator-action]: input-validation hardening, no new env/config/operator step.🤖 Generated with Claude Code