awesome-repositories.com
Blog
MCP
awesome-repositories.com

Discover the best open-source repositories with AI-powered search.

ExploreCurated searchesOpen-source alternativesSelf-hosted softwareBlogSitemap
ProjectMCP serverAboutHow we rankPress
LegalPrivacyTerms
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
microcosm-cc avatar

microcosm-cc/bluemonday

0
View on GitHub↗
3,688 stars·193 forks·Go·BSD-3-Clause·17 viewsgithub.com/microcosm-cc/bluemonday↗

Bluemonday

bluemonday is a Go library for scrubbing user-generated HTML content to prevent cross-site scripting and other injection attacks. It functions as an HTML policy engine and sanitizer that removes dangerous scripts and malicious tags by applying configurable element and attribute allowlists.

The project distinguishes itself through a rule-based system that utilizes regular expressions and name-based lists to define permitted tags, attributes, and CSS styles. It includes a URL security validator that enforces safe protocols and automatically injects security attributes such as nofollow and noopener into outbound hyperlinks.

The library covers a broad range of sanitization capabilities, including inline CSS validation, data URI filtering for embedded images, and attribute value verification. It employs a streaming token-based parsing model to identify and scrub unsafe content without loading the entire document tree.

Features

  • Cross-Site Scripting Prevention - Prevents cross-site scripting by cleaning user-submitted HTML content of malicious scripts.
  • HTML Content Sanitization - Provides a comprehensive engine for scrubbing user-generated HTML content to prevent cross-site scripting and injection attacks.
  • HTML Content Policies - Acts as a rule-based engine for defining permitted HTML tags, attributes, and CSS styles.
  • CSS Sanitizers - Validates and cleans inline CSS style attributes to prevent malicious payloads from being injected via styles.
  • Injection Prevention - Removes dangerous scripts and malicious tags from HTML documents to prevent injection attacks.
  • Policy Configurations - Implements a flexible rule-based system using regular expressions and allowlists to define permitted HTML tags and attributes.
  • Link Security Policies - Enforces security attributes and restricts permitted protocols for outbound hyperlinks.
  • URL Protocol Sanitizers - Validates and transforms URL protocols to prevent javascript and data URI injection attacks.
  • HTML Allowlists - Implements HTML allowlists to define permitted tags and attributes for secure rendering.
  • Secure Renderers - Prepares raw HTML strings for safe browser display by stripping dangerous tags and enforcing link security.
  • HTML Tokenization - Employs a streaming tokenization model to process HTML without loading the entire document tree into memory.
  • URL and Data URI Filtering - Validates URLs and data URIs within HTML to restrict permitted protocols and ensure safe inline resources.
  • Automatic Attribute Injection - Automatically injects security attributes such as nofollow and target blank into fully qualified outbound links.
  • Resource URL Validations - Enforces safe URL protocols and manages security attributes for embedded resources and hyperlinks.
  • Security Attribute Injection - Automatically appends security attributes like nofollow and noopener to outbound hyperlinks.
  • Regular Expression Validations - Uses regular expression validations to identify and verify permitted element names and attribute values.
  • Pattern-Based Value Validation - Verifies that attribute values match specific patterns, such as dates or alignment keywords, using regular expressions.
  • CSS Security Validators - Provides specialized handlers to validate inline CSS style attributes against security patterns.
  • Security Filtering - Verifies the mime-type and base64 encoding of data URIs to safely allow inline images.
  • Security Validation - Ensures inline data URIs use safe image formats through MIME type and encoding verification.
  • HTML Attribute Restrictions - Controls which attributes are permitted on specific HTML tags or groups of tags.
  • Text Processing - HTML sanitizer for preventing XSS attacks.

Star history

Star history chart for microcosm-cc/bluemondayStar history chart for microcosm-cc/bluemonday

How this analysis was created: This summary and feature list were written by an AI model that read the project's README and public documentation pages. Each feature links to the documentation it came from; stars, license and language come straight from the GitHub API. The model does not read the source code, and the analysis is refreshed when the project is re-analysed. Learn more on our About page.

AI search

Explore more awesome repositories

Describe what you need in plain English — the AI ranks thousands of curated open-source projects by relevance.

Start searching with AI

Open-source alternatives to Bluemonday

Similar open-source projects, ranked by how many features they share with Bluemonday.
  • apostrophecms/sanitize-htmlapostrophecms avatar

    apostrophecms/sanitize-html

    4,129View on GitHub↗

    This is an HTML sanitization library designed to remove dangerous tags and attributes from user-submitted HTML to prevent cross-site scripting attacks. It functions as a content filter that whitelists specific elements and attributes while escaping or discarding unauthorized markup. The project includes an HTML transformation engine that allows for the modification or replacement of tags and attributes using custom logic. It also features a CSS style validator to clean inline properties against permitted patterns and a system for resource URL validation to restrict hostnames and schemes. The

    JavaScript
    View on GitHub↗4,129
  • leizongmin/js-xssleizongmin avatar

    leizongmin/js-xss

    5,319View on GitHub↗

    js-xss is an HTML XSS sanitizer and whitelist-based HTML filter designed to remove malicious code from untrusted HTML. It serves as a tool for cross-site scripting prevention and user-generated content management by cleaning HTML strings to ensure safe browser rendering. The library includes a CSS style validator to scrub inline styles against a whitelist and an HTML content purifier capable of stripping all tags to extract raw text. It allows for custom HTML filtering through the definition of specific rules and handler functions to control permitted elements and attributes. The tool covers

    HTML
    View on GitHub↗5,319
  • cure53/dompurifycure53 avatar

    cure53/DOMPurify

    16,638View on GitHub↗

    DOMPurify is a security-focused library designed to sanitize untrusted HTML input, preventing cross-site scripting attacks by stripping malicious code while preserving safe content. It functions as a utility for secure document object model manipulation, ensuring that user-provided rich text can be rendered safely within web applications. The library distinguishes itself through a single-pass, mutation-observer-free processing model that operates on detached document fragments to avoid triggering unintended side effects. It employs recursive node traversal and context-aware logic to inspect a

    JavaScriptcross-site-scriptingdomdompurify
    View on GitHub↗16,638
  • a-h/templa-h avatar

    a-h/templ

    10,358View on GitHub↗

    Templ is a type-safe HTML templating engine and UI framework for Go. It provides a system for building reusable HTML components that compile into Go code for server-side rendering, ensuring type safety and compile-time validation of data and logic. The project features a dedicated language server that provides autocomplete and syntax validation for template files within supported code editors. It employs compile-time code generation to transform a custom template language into Go source code, enabling the creation of modular HTML fragments and logic blocks. The framework includes automated s

    Gogohtml-elementshtmx
    View on GitHub↗10,358
See all 30 alternatives to Bluemonday→

Frequently asked questions

What does microcosm-cc/bluemonday do?

bluemonday is a Go library for scrubbing user-generated HTML content to prevent cross-site scripting and other injection attacks. It functions as an HTML policy engine and sanitizer that removes dangerous scripts and malicious tags by applying configurable element and attribute allowlists.

What are the main features of microcosm-cc/bluemonday?

The main features of microcosm-cc/bluemonday are: Cross-Site Scripting Prevention, HTML Content Sanitization, HTML Content Policies, CSS Sanitizers, Injection Prevention, Policy Configurations, Link Security Policies, URL Protocol Sanitizers.

What are some open-source alternatives to microcosm-cc/bluemonday?

Open-source alternatives to microcosm-cc/bluemonday include: apostrophecms/sanitize-html — This is an HTML sanitization library designed to remove dangerous tags and attributes from user-submitted HTML to… leizongmin/js-xss — js-xss is an HTML XSS sanitizer and whitelist-based HTML filter designed to remove malicious code from untrusted HTML.… cure53/dompurify — DOMPurify is a security-focused library designed to sanitize untrusted HTML input, preventing cross-site scripting… vercel/streamdown — Streamdown is a streaming markdown renderer for React that transforms incoming markdown text into sanitized HTML in… a-h/templ — Templ is a type-safe HTML templating engine and UI framework for Go. It provides a system for building reusable HTML… rgrove/sanitize — Sanitize is a Ruby library designed to clean untrusted HTML and CSS input by enforcing strict security policies. It…