Files
FOSSBilling/tests/Unit
Adam DaleyandClaude Sonnet 4.6 aefaa01db6 Preserve < and > in ticket/KB messages by using Markdown-safe sanitization (#3830)
* fix(support): preserve < and > in ticket/KB messages by using Markdown-safe sanitization

The WYSIWYG editor (CKEditor) uses the Markdown plugin, so ticket replies
and KB article bodies are stored as Markdown, not HTML. Calling the Symfony
HTML Sanitizer on Markdown content silently corrupts it: when a user types
text containing an unknown tag-like string such as `<World>`, the sanitizer
treats it as an unknown HTML element, drops it, and—because there is no
closing tag—also drops everything that follows, causing the rest of the
message to disappear.

Fix by introducing `Tools::sanitizeMarkdownContent()`, which only strips
null bytes and trims whitespace. XSS protection is already provided at
render time by the `|markdown_to_html` Twig filter, whose underlying
CommonMark converter is configured with `html_input: escape`—any raw HTML
inside the stored Markdown is therefore escaped before it reaches the
browser.

Affected endpoints (all now use the new helper):
- Admin: ticket_reply, ticket_create, kb_article_create, kb_article_update
- Client: ticket_create, ticket_reply
- Guest: ticket_create, ticket_reply

Fixes #3827

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LBnxaZxj968uFFbgoSocLZ

* fix(spellcheck): use American English spelling "unrecognized"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LBnxaZxj968uFFbgoSocLZ

* fix(support): apply markdown-body styling to admin ticket and client KB article views

The admin ticket conversation and client KB article content were rendered
with |markdown_to_html but without the markdown.css stylesheet or the
markdown-body CSS class required by github-markdown-css.  This caused
inline code, fenced code blocks, and other Markdown elements to appear
unstyled (admin) or miscontainerised in a list-group div (client KB).

- Admin ticket: load markdown.css in <head> and wrap message content in
  <article class="markdown-body bg-transparent text-reset">
- Client KB article: load markdown.css in <head> and replace the
  list-group wrapper with <article class="markdown-body bg-transparent
  text-reset">

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LBnxaZxj968uFFbgoSocLZ

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-23 19:22:41 +02:00
..