Skip to content

Releases: rgrove/sanitize

v6.1.3

14 Aug 17:17
v6.1.3
b0ec1d6
Compare
Choose a tag to compare

Bug Fixes

  • The CSS URL protocol allowlist is now enforced on the nonstandard -webkit-image-set CSS function. @ltk - #242

v6.1.2

27 Jul 18:58
v6.1.2
a98ac98
Compare
Choose a tag to compare

Bug Fixes

v6.1.1

13 Jun 00:12
v6.1.1
2bc3d4a
Compare
Choose a tag to compare

Bug Fixes

  • Proactively fixed a compatibility issue with libxml >= 2.13.0 (which will be used in an upcoming version of Nokogiri) that caused HTML doctype sanitization to fail. @flavorjones - #238

v6.1.0

14 Sep 21:54
7194dca
Compare
Choose a tag to compare

Features

  • Added the text-decoration-skip-ink and text-decoration-thickness CSS properties to the relaxed config. @martineriksson - #228

v6.0.2

06 Jul 14:57
76ed46e
Compare
Choose a tag to compare

Bug Fixes

  • CVE-2023-36823: Fixed an HTML+CSS sanitization bypass that could allow XSS (cross-site scripting). This issue affects Sanitize versions 3.0.0 through 6.0.1.

    When using Sanitize's relaxed config or a custom config that allows <style> elements and one or more CSS at-rules, carefully crafted input could be used to sneak arbitrary HTML through Sanitize.

    See the following security advisory for additional details: GHSA-f5ww-cq3m-q3g7

    Thanks to @cure53 for finding this issue.

v6.0.1

27 Jan 18:22
v6.0.1
a92f21c
Compare
Choose a tag to compare

Bug Fixes

  • Sanitize now always removes <noscript> elements and their contents, even when noscript is in the allowlist.

    This fixes a sanitization bypass that could occur when noscript was allowed by a custom allowlist. In this scenario, carefully crafted input could sneak arbitrary HTML through Sanitize, potentially enabling an XSS (cross-site scripting) attack.

    Sanitize's default configs don't allow <noscript> elements and are not vulnerable. This issue only affects users who are using a custom config that adds noscript to the element allowlist.

    The root cause of this issue is that HTML parsing rules treat the contents of a <noscript> element differently depending on whether scripting is enabled in the user agent. Nokogiri doesn't support scripting so it follows the "scripting disabled" rules, but a web browser with scripting enabled will follow the "scripting enabled" rules. This means that Sanitize can't reliably make the contents of a <noscript> element safe for scripting enabled browsers, so the safest thing to do is to remove the element and its contents entirely.

    See the following security advisory for additional details: GHSA-fw3g-2h3j-qmm7

    Thanks to David Klein from TU Braunschweig (@leeN) for reporting this issue.

  • Fixed an edge case in which the contents of an "unescaped text" element (such as <noembed> or <xmp>) were not properly escaped if that element was allowlisted and was also inside an allowlisted <math> or <svg> element.

    The only way to encounter this situation was to ignore multiple warnings in the readme and create a custom config that allowlisted all the elements involved, including <math> or <svg>. If you're using a default config or if you heeded the warnings about MathML and SVG not being supported, you're not affected by this issue.

    Please let this be a reminder that Sanitize cannot safely sanitize MathML or SVG content and does not support this use case. The default configs don't allow MathML or SVG elements, and allowlisting MathML or SVG elements in a custom config may create a security vulnerability in your application.

    Documentation has been updated to add more warnings and to make the existing warnings about this more prominent.

    Thanks to David Klein from TU Braunschweig (@leeN) for reporting this issue.

v6.0.0

04 Aug 04:30
Compare
Choose a tag to compare

Potentially Breaking Changes

  • Ruby 2.5.0 is now the oldest officially supported Ruby version.

  • Sanitize now requires Nokogiri 1.12.0 or higher, which includes Nokogumbo. The separate dependency on Nokogumbo has been removed. @lis2 - #211

v5.2.3

11 Jan 23:43
Compare
Choose a tag to compare

Bug Fixes

  • Ensure protocol sanitization is applied to data attributes. @ccutrer - #207

v5.2.2

06 Jan 19:03
Compare
Choose a tag to compare

Bug Fixes

  • Fixed a deprecation warning in Ruby 2.7+ when using keyword arguments in a custom transformer. @mscrivo - #206

v5.2.1

16 Jun 18:06
Compare
Choose a tag to compare

Bug Fixes

  • Fixed an HTML sanitization bypass that could allow XSS. This issue affects Sanitize versions 3.0.0 through 5.2.0.

    When HTML was sanitized using the "relaxed" config or a custom config that allows certain elements, some content in a <math> or <svg> element may not have beeen sanitized correctly even if math and svg were not in the allowlist. This could allow carefully crafted input to sneak arbitrary HTML through Sanitize, potentially enabling an XSS (cross-site scripting) attack.

    You are likely to be vulnerable to this issue if you use Sanitize's relaxed config or a custom config that allows one or more of the following HTML elements:

    • iframe
    • math
    • noembed
    • noframes
    • noscript
    • plaintext
    • script
    • style
    • svg
    • xmp

    See the security advisory for more details, including a workaround if you're not able to upgrade: GHSA-p4x4-rw2p-8j8m

    Many thanks to Michał Bentkowski of Securitum for reporting this issue and helping to verify the fix.