justhtml
Affected
- introduced
0, fixed1.17.0(ecosystem)
Fixed versions
1.17.0
Fix
- Fixed version
1.17.0pip install --upgrade justhtml==1.17.0
Advisory
Also known as: CVE-2026-6827
justhtml has sanitization bypass in custom policies and programmatic DOM
Summary
justhtml 1.17.0 fixes multiple security issues in sanitization, serialization, and programmatic DOM handling.
Most of these issues affected advanced or custom configurations rather than the default safe path.
Affected versions
justhtml <= 1.16.0Fixed version
justhtml 1.17.0 released on April 19, 2026Impact
Custom SVG / MathML sanitization policies
Custom policies that preserved foreign namespaces could allow dangerous content to survive sanitization, including:
<foreignObject>, MathML <annotation-xml encoding="text/html">, SVG <title> / <desc>, and MathML text integration pointsfilter="url(...)" attributes that could trigger external fetchesThese issues affected:
JustHTML(..., sanitize=True) with custom foreign-namespace policiessanitize() / sanitize_dom()Sanitize(...) transform executionPreserved <style> handling
Constructor-time sanitization and explicit Sanitize(...) transforms did not fully match sanitize() / sanitize_dom() when custom policies preserved <style>.
That could leave resource-loading CSS such as @import or background-image:url(...) in sanitized output from HTML string input.
Programmatic DOM serialization
Programmatic script, style, and Comment(...) nodes could still serialize into active markup in some edge cases.
This could affect applications that build or mutate DOM trees directly before calling to_html() or to_markdown(html_passthrough=True).
Cache mutation and DOM cycle handling
Two lower-severity hardening fixes were included:
to_html() and sanitize_dom()Default configuration
Most of the issues above did not affect ordinary parsed HTML with the default JustHTML(..., sanitize=True) configuration.
The main risk areas were:
<style>Recommended action
Upgrade to justhtml 1.17.0.
If users cannot upgrade immediately:
<style> for untrusted inputscript, style, or comment contentCredit
Discovered during an internal security review of justhtml.
Medium Basis: The source's own band: MODERATE
0, fixed 1.17.0 (ecosystem)1.17.0
1.17.0pip install --upgrade justhtml==1.17.0Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0