# microcosm-cc/bluemonday

bluemonday: a fast golang HTML sanitizer (inspired by the OWASP Java HTML Sanitizer) to scrub user generated content of XSS

Repository: https://github.com/microcosm-cc/bluemonday
Canonical: https://ross.abutalabs.com/products/bluemonday
Homepage: https://github.com/microcosm-cc/bluemonday
Language: Go
License: BSD-3-Clause
License Family: permissive
Topics: sanitization, html, security, xss, go, owasp, allowlist, golang
Last push: 2025-04-04T09:55:48+00:00

## Health v2 (maintenance only)
Score: 29/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 14, release rhythm 8, longevity 100
- inputs: {"age_days": 4669, "days_push": 516, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 3714, forks 195 (observed 2026-08-28T04:08:15.308873+00:00)

## What it is
bluemonday is a fast, highly configurable HTML sanitizer library for Go, inspired by the OWASP Java HTML Sanitizer. It takes untrusted user-generated content and returns HTML sanitized against an allowlist of approved elements and attributes to prevent XSS attacks.

## Use cases
- sanitize user comments before rendering on a web page
- strip javascript: URLs and event handlers from HTML input
- allow only safe HTML tags in forum or CMS posts
- clean HTML output from markdown processors like blackfriday or Pandoc
- prevent XSS attacks from user generated content in a Go web server
- enforce an allowlist of permitted HTML elements and attributes

## When to choose
- your Go server accepts and displays user-generated HTML
- you need a fast, allowlist-based sanitizer with configurable policies
- you want OWASP-aligned XSS mitigation for HTML content
- you need to sanitize output after markdown or other HTML-producing processing

## When to avoid
- you need to repair badly nested or incomplete HTML rather than sanitize it
- you are not working in Go
- you need a browser-side or client-side sanitizer
- you need full HTML validation or parsing of malformed documents

## Facets
- artifact type: library
- maturity: stable
- function: security, parser, web-framework
- domain: security, web-development, developer-tools
- platform: go, cross-platform
- tags: html-sanitizer, xss-protection, allowlist, user-generated-content, owasp

## Member repositories
- microcosm-cc/bluemonday (main) score 29

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:15.308873+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:29:24.150698+00:00, confidence not recorded.
  - readme: https://github.com/microcosm-cc/bluemonday (fetched 2026-08-28T04:08:15.308873+00:00, sha 9f0b31ffd46a)
  - homepage: https://github.com/microcosm-cc/bluemonday (fetched 2026-08-29T09:24:11.182620+00:00, sha 0b190815f2b5)
- Data as of 2026-08-30T08:39:29.467469+00:00.
