sanitize 6.1.2 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/{HISTORY.md → CHANGELOG.md} +40 -14
- data/LICENSE +3 -1
- data/README.md +120 -238
- data/lib/sanitize/config/basic.rb +15 -15
- data/lib/sanitize/config/default.rb +45 -45
- data/lib/sanitize/config/relaxed.rb +136 -32
- data/lib/sanitize/config/restricted.rb +2 -2
- data/lib/sanitize/config.rb +12 -14
- data/lib/sanitize/css.rb +309 -303
- data/lib/sanitize/transformers/clean_cdata.rb +9 -9
- data/lib/sanitize/transformers/clean_comment.rb +9 -9
- data/lib/sanitize/transformers/clean_css.rb +59 -55
- data/lib/sanitize/transformers/clean_doctype.rb +15 -15
- data/lib/sanitize/transformers/clean_element.rb +220 -237
- data/lib/sanitize/version.rb +3 -1
- data/lib/sanitize.rb +38 -38
- data/test/common.rb +4 -3
- data/test/test_clean_comment.rb +26 -25
- data/test/test_clean_css.rb +14 -13
- data/test/test_clean_doctype.rb +21 -20
- data/test/test_clean_element.rb +258 -273
- data/test/test_config.rb +22 -21
- data/test/test_malicious_css.rb +20 -19
- data/test/test_malicious_html.rb +100 -99
- data/test/test_parser.rb +26 -25
- data/test/test_sanitize.rb +70 -69
- data/test/test_sanitize_css.rb +152 -114
- data/test/test_transformers.rb +81 -83
- metadata +14 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7ec07b16780ba818a5fdbb0570fb6c84245c60b2656388cab0b03b0d00bbc6a
|
4
|
+
data.tar.gz: 650c2a0c59fd4af1d305051e5488bcacee3f5a638a96960163f6677b838a9661
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec33f841766422dda2ee1d889d2e3f42f6b3b479c2cf557cad80de0311969a4e132e02a5a33dda296af2e2a5fec8791aa6ba8eacd6ea370428cc40ff3f08a720
|
7
|
+
data.tar.gz: f4cf669dba8e416c38fb4b9eae30b86e9c7816718e80cc32eac1f536f1e2023c59cb74df7e701af717a157e1fe1ccc902a89b26992488a85400e4dc0c089d07a
|
data/{HISTORY.md → CHANGELOG.md}
RENAMED
@@ -1,4 +1,32 @@
|
|
1
|
-
# Sanitize
|
1
|
+
# Sanitize Changelog
|
2
|
+
|
3
|
+
All notable changes to Sanitize are documented in this file. The format (since version 7.0.0) is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
4
|
+
|
5
|
+
## 7.0.0 (2024-12-29)
|
6
|
+
|
7
|
+
Sanitize has no breaking API changes in this release, but the major version number has been incremented because we've dropped support for end-of-life versions of Ruby. As long as you're using Ruby 3.1.0 or later, this should be a painless upgrade!
|
8
|
+
|
9
|
+
### Added
|
10
|
+
|
11
|
+
- Added over 100 new CSS properties to the relaxed config, representing all properties that are listed with a status of "Working Draft" or better in the latest [W3C "All Properties" list](https://www.w3.org/Style/CSS/all-properties.en.html).
|
12
|
+
|
13
|
+
- Added the `@container` CSS at-rule to the relaxed config.
|
14
|
+
|
15
|
+
- Added the `-webkit-text-fill-color` CSS property to the relaxed config. [@radar - #244](https://github.com/rgrove/sanitize/pull/244)
|
16
|
+
|
17
|
+
### Changed
|
18
|
+
|
19
|
+
- Ruby 3.1.0 is now the oldest supported Ruby version.
|
20
|
+
|
21
|
+
- Sanitize now requires Nokogiri 1.16.8 or higher.
|
22
|
+
|
23
|
+
## 6.1.3 (2024-08-14)
|
24
|
+
|
25
|
+
### Bug Fixes
|
26
|
+
|
27
|
+
* The CSS URL protocol allowlist is now enforced on the nonstandard `-webkit-image-set` CSS function. [@ltk - #242][242]
|
28
|
+
|
29
|
+
[242]:https://github.com/rgrove/sanitize/pull/242
|
2
30
|
|
3
31
|
## 6.1.2 (2024-07-27)
|
4
32
|
|
@@ -271,8 +299,6 @@ review the changes below carefully.
|
|
271
299
|
Many thanks to the Shopify Application Security Team for responsibly reporting
|
272
300
|
this issue.
|
273
301
|
|
274
|
-
[176]:https://github.com/rgrove/sanitize/issues/176
|
275
|
-
|
276
302
|
## 4.6.2 (2018-03-19)
|
277
303
|
|
278
304
|
* Reduced string allocations to optimize memory usage. [@janklimo - #175][175]
|
@@ -610,7 +636,7 @@ Sanitize.fragment(html, Sanitize::Config.merge(Sanitize::Config::BASIC,
|
|
610
636
|
## 2.0.4 (2013-06-12)
|
611
637
|
|
612
638
|
* Added `Sanitize.clean_document`, which sanitizes a full HTML document rather
|
613
|
-
than just a fragment. [Ben Anderson]
|
639
|
+
than just a fragment. \[Ben Anderson]
|
614
640
|
|
615
641
|
* Nokogiri dependency bumped to 1.6.x.
|
616
642
|
|
@@ -633,7 +659,7 @@ Sanitize.fragment(html, Sanitize::Config.merge(Sanitize::Config::BASIC,
|
|
633
659
|
## 2.0.1 (2011-03-16)
|
634
660
|
|
635
661
|
* Updated the protocol regex to anchor at the beginning of the string rather
|
636
|
-
than the beginning of a line. [Eaden McKee]
|
662
|
+
than the beginning of a line. \[Eaden McKee]
|
637
663
|
|
638
664
|
|
639
665
|
## 2.0.0 (2011-01-15)
|
@@ -679,7 +705,7 @@ Sanitize.fragment(html, Sanitize::Config.merge(Sanitize::Config::BASIC,
|
|
679
705
|
remove the contents of all non-allowlisted elements in addition to the
|
680
706
|
elements themselves. If set to an array of element names, Sanitize will
|
681
707
|
remove the contents of only those elements (when filtered), and leave the
|
682
|
-
contents of other filtered elements. [Thanks to Rafael Souza for the array
|
708
|
+
contents of other filtered elements. \[Thanks to Rafael Souza for the array
|
683
709
|
option]
|
684
710
|
|
685
711
|
* Added an `:output_encoding` config setting to allow the character encoding
|
@@ -704,27 +730,27 @@ Sanitize.fragment(html, Sanitize::Config.merge(Sanitize::Config::BASIC,
|
|
704
730
|
* Added `Sanitize.clean_node!`, which sanitizes a `Nokogiri::XML::Node` and
|
705
731
|
all its children.
|
706
732
|
|
707
|
-
* Added elements `<h1>` through `<h6>` to the Relaxed allowlist. [Suggested by
|
733
|
+
* Added elements `<h1>` through `<h6>` to the Relaxed allowlist. \[Suggested by
|
708
734
|
David Reese]
|
709
735
|
|
710
736
|
|
711
737
|
## 1.1.0 (2009-10-11)
|
712
738
|
|
713
|
-
* Migrated from Hpricot to Nokogiri. Requires libxml2 >= 2.7.2 [Adam Hooper]
|
739
|
+
* Migrated from Hpricot to Nokogiri. Requires libxml2 >= 2.7.2 \[Adam Hooper]
|
714
740
|
|
715
741
|
* Added an `:output` config setting to allow the output format to be
|
716
742
|
specified. Supported formats are `:xhtml` (the default) and `:html` (which
|
717
743
|
outputs HTML4).
|
718
744
|
|
719
745
|
* Changed protocol regex to ensure Sanitize doesn't kill URLs with colons in
|
720
|
-
path segments. [Peter Cooper]
|
746
|
+
path segments. \[Peter Cooper]
|
721
747
|
|
722
748
|
|
723
749
|
## 1.0.8 (2009-04-23)
|
724
750
|
|
725
751
|
* Added a workaround for an Hpricot bug that prevents attribute names from
|
726
752
|
being downcased in recent versions of Hpricot. This was exploitable to
|
727
|
-
prevent non-allowlisted protocols from being cleaned. [Reported by Ben
|
753
|
+
prevent non-allowlisted protocols from being cleaned. \[Reported by Ben
|
728
754
|
Wanicur]
|
729
755
|
|
730
756
|
|
@@ -733,7 +759,7 @@ Sanitize.fragment(html, Sanitize::Config.merge(Sanitize::Config::BASIC,
|
|
733
759
|
* Requires Hpricot 0.8.1+, which is finally compatible with Ruby 1.9.1.
|
734
760
|
|
735
761
|
* Fixed a bug that caused named character entities containing digits (like
|
736
|
-
`²`) to be escaped when they shouldn't have been. [Reported by
|
762
|
+
`²`) to be escaped when they shouldn't have been. \[Reported by
|
737
763
|
Sebastian Steinmetz]
|
738
764
|
|
739
765
|
|
@@ -748,14 +774,14 @@ Sanitize.fragment(html, Sanitize::Config.merge(Sanitize::Config::BASIC,
|
|
748
774
|
problems in IE6.
|
749
775
|
|
750
776
|
* You can now specify the symbol `:all` in place of an element name in the
|
751
|
-
attributes config hash to allow certain attributes on all elements. [Thanks
|
777
|
+
attributes config hash to allow certain attributes on all elements. \[Thanks
|
752
778
|
to Mutwin Kraus]
|
753
779
|
|
754
780
|
|
755
781
|
## 1.0.5 (2009-02-05)
|
756
782
|
|
757
783
|
* Fixed a bug introduced in version 1.0.3 that prevented non-allowlisted
|
758
|
-
protocols from being cleaned when relative URLs were allowed. [Reported by
|
784
|
+
protocols from being cleaned when relative URLs were allowed. \[Reported by
|
759
785
|
Dev Purkayastha]
|
760
786
|
|
761
787
|
* Fixed "undefined method `parent='" exceptions caused by parser changes in
|
@@ -766,7 +792,7 @@ Sanitize.fragment(html, Sanitize::Config.merge(Sanitize::Config::BASIC,
|
|
766
792
|
|
767
793
|
* Fixed a bug that made it possible to sneak a non-allowlisted element through
|
768
794
|
by repeating it several times in a row. All versions of Sanitize prior to
|
769
|
-
1.0.4 are vulnerable. [Reported by Cristobal]
|
795
|
+
1.0.4 are vulnerable. \[Reported by Cristobal]
|
770
796
|
|
771
797
|
|
772
798
|
## 1.0.3 (2009-01-15)
|
data/LICENSE
CHANGED