mganss/HtmlSanitizer
Cleans HTML to avoid XSS attacks observed · 2026-08-28
Health v2 · maintenance only
98/100
- Activity 99
- Release rhythm 97
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-02. Adoption (stars, forks) is never an input.
- gap_med: 7
- age_days: 4817
- days_rel: 23
- days_push: 7
- n_releases_24m: 12
Adoption not part of the score
1707 stars · 231 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
A .NET library for cleaning HTML fragments and documents of constructs that can lead to XSS attacks, built on the AngleSharp parser. It is highly configurable, allowing control over allowed tags, attributes, CSS properties, and URI schemes.
Use cases
- sanitize user-submitted HTML to prevent XSS
- clean HTML fragments before rendering in a web app
- strip dangerous tags and attributes from rich text input
- allow only whitelisted HTML tags and CSS properties
- protect against tag poisoning from malformed HTML
- sanitize HTML in ASP.NET applications
When to choose
- you need a robust, parser-based HTML sanitizer in .NET
- you need fine-grained control over allowed tags, attributes, CSS, and URI schemes
- you want protection against malformed HTML corrupting document structure
When to avoid
- your project is not on the .NET platform
- you only need to escape plain text rather than sanitize rich HTML
- you need a browser-side JavaScript sanitizer
Facets
library · maturity active
security parser templating security web-development backend dotnet cross-platform xss html-sanitizer html-parsing css-sanitization anglesharp
1 source
- readme: https://github.com/mganss/HtmlSanitizer · fetched 2026-08-28 · e5c0f4028d92
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| mganss/HtmlSanitizer | main | 98 |
For agents
markdown · JSON · MCP: product_card(name="mganss/HtmlSanitizer")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem