Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Dom Sanitizer Laravel Package

rhukster/dom-sanitizer

MIT-licensed PHP 7.3+ DOM/SVG/MathML sanitizer using DOMDocument and DOMPurify-based allowlists. Remove dangerous tags/attributes, strip namespaces and PHP/HTML/XML tags, and optionally compress output. Supports HTML, SVG, and MathML modes.

View on GitHub
Deep Wiki
Context7
1.0.11

Security

  • Harden loadDocument against XXE and entity-expansion attacks

  • Strip and declarations from sanitizer input before parsing, then call loadXML/loadHTML with LIBXML_NONET so the parser cannot make outbound filesystem or network requests for external entities/DTDs. Also calls libxml_disable_entity_loader on PHP < 8 (no-op on PHP 8+, where the default already declines external entities).

  • Closes the dom-sanitizer half of GHSA-3446-6mgw-f79p (filed against Grav, which uses this library as its SVG sanitizer). The companion fix in Grav core is in VectorImageMedium's dimension reader.

  • Two new XXE regression tests added to DomSanitizerTest:

    • file:// SYSTEM entity payload — must not expand into /etc/passwd
    • billion-laughs DOCTYPE — must not balloon memory
1.0.10

Security

  • Fixed CSS injection via SVG/HTML <style> text content (GHSA-93vf-569f-22cq) — DOMSanitizer::sanitize() allowed <style> elements in both SVG and HTML mode but never inspected their text content, letting CSS url() references and [@import](https://github.com/import) rules pass through unfiltered. An attacker could exfiltrate the page URL to an external host, load arbitrary stylesheets, or use CSS attribute-selector tricks to leak form token values. The fix walks <style> text nodes and drops the element if it contains [@import](https://github.com/import), url(...) with an external scheme (http:, https:, ftp:, //, data:), or legacy expression(). CSS hex escapes like \75 rl(...) are decoded before matching so escape-based bypasses are caught. Fragment references such as url(#gradientId) are preserved so SVG <defs>, gradients, filters, and masks continue to work normally.
1.0.9

Security & Bug Fixes

Security

  • Fixed SVG sanitizer bypass via ASCII whitespace entities (https://github.com/rhukster/dom-sanitizer/issues/6) — Addresses a bypass of the CVE-2026-33172 fix where character entities like (tab), (newline), and (CR) could be used to smuggle javascript: URIs past the regex-based sanitization. The fix adds DOM-level URL scheme validation that operates on decoded attribute values, eliminating this entire class of entity-encoding bypasses.
  • Added comprehensive XSS event handler tests for GHSA-gxwg-x2jg-q44j to improve test coverage of onload, onclick, onerror, onmouseover, and other event handler stripping across SVG and HTML contexts.
  • Added SECURITY.md with instructions for private vulnerability reporting.

Bug Fixes

  • Fixed SVG filter elements being incorrectly removed (https://github.com/rhukster/dom-sanitizer/issues/5) — SVG filter tags (feGaussianBlur, feBlend, feColorMatrix, etc.) were defined in camelCase but compared against lowercased tag names, causing all filter elements to be silently stripped during sanitization.
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai