Skip to content

Escape HTML in LDKController to prevent XSS#288

Merged
labkey-martyp merged 1 commit into
release25.7-SNAPSHOTfrom
25.7_fb_escape_html_output
Jun 22, 2026
Merged

Escape HTML in LDKController to prevent XSS#288
labkey-martyp merged 1 commit into
release25.7-SNAPSHOTfrom
25.7_fb_escape_html_output

Conversation

@labkey-martyp

@labkey-martyp labkey-martyp commented Jun 22, 2026

Copy link
Copy Markdown

Rationale

Two spots in LDKController rendered untrusted content as raw HTML. The container-scoped-table inspection view is a correction to a previous security fix (#268): the HTMLView cleanup there wrapped the whole string in HtmlString.of, which escaped the literal
/

markup too — safe, but it broke the intended formatting. This escapes only the dynamic validation messages (which can contain arbitrary content from direct DB inserts that bypass the user schema) while preserving the markup. The invalid-redirect error message separately echoed the user-supplied URL via HtmlString.unsafe, so it is now escaped.

Related Pull Requests

Changes

  • Container-scoped-table inspection view: escape each validation message with PageFlowUtil.filter before joining with
    , then wrap the assembled markup in HtmlString.unsafe — fixing the over-escaping introduced by Audit EHR notification events #268 while keeping the output safe.
  • Invalid-redirect error message: switch the user-supplied URL from HtmlString.unsafe to HtmlString.of so it is escaped.

Escape each container-scoped-table validation message with PageFlowUtil.filter before joining with <br> in the table-inspection view, since direct DB inserts can place arbitrary content in those messages. Also escape the redirect URL in the invalid-redirect error message by switching from HtmlString.unsafe to HtmlString.of.
@labkey-martyp labkey-martyp merged commit ab2575e into release25.7-SNAPSHOT Jun 22, 2026
10 of 11 checks passed
@labkey-martyp labkey-martyp deleted the 25.7_fb_escape_html_output branch June 22, 2026 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants