Skip to content

Improve comment HTML filtering and allowlist support - #866

Merged
poppastring merged 1 commit into
mainfrom
html-sanitization-handling
Jul 4, 2026
Merged

poppastring merged 1 commit into
mainfrom
html-sanitization-handling

Conversation

@poppastring

Copy link
Copy Markdown
Owner

Improve comment HTML filtering and allowlist support

Replaced legacy regex HTML filter with Ganss.Xss HtmlSanitizer, honoring ValidCommentTags for allowed tags and attributes. Falls back to HTML-encoding if no tags are allowed. Updated CommentContentTagHelper to only insert
for plain text comments. Added unit tests for allowlist enforcement, wrapper tag handling, and plain text encoding. Refactored for clarity and maintainability.

Replaced legacy regex HTML filter with Ganss.Xss HtmlSanitizer, honoring ValidCommentTags for allowed tags and attributes. Falls back to HTML-encoding if no tags are allowed. Updated CommentContentTagHelper to only insert <br /> for plain text comments. Added unit tests for allowlist enforcement, wrapper tag handling, and plain text encoding. Refactored for clarity and maintainability.
@poppastring
poppastring merged commit 5c8f76c into main Jul 4, 2026
3 checks passed
@poppastring
poppastring deleted the html-sanitization-handling branch July 4, 2026 20:30
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.

1 participant