Escape HTML in LDKController to prevent XSS#288
Merged
Conversation
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.
bbimber
approved these changes
Jun 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
, then wrap the assembled markup in HtmlString.unsafe — fixing the over-escaping introduced by Audit EHR notification events #268 while keeping the output safe.