sanitize 6.0.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} +64 -14
- data/LICENSE +3 -1
- data/README.md +120 -239
- data/lib/sanitize/config/basic.rb +15 -15
- data/lib/sanitize/config/default.rb +45 -45
- data/lib/sanitize/config/relaxed.rb +138 -32
- data/lib/sanitize/config/restricted.rb +2 -2
- data/lib/sanitize/config.rb +12 -14
- data/lib/sanitize/css.rb +317 -284
- 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 +17 -13
- 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 +158 -114
- data/test/test_transformers.rb +81 -83
- metadata +16 -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,56 @@
|
|
|
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
|
|
30
|
+
|
|
31
|
+
## 6.1.2 (2024-07-27)
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* The CSS URL protocol allowlist is now properly enforced in [CSS Images Module Level 4](https://drafts.csswg.org/css-images-4/) `image` and `image-set` functions. [@ltk - #240][240]
|
|
36
|
+
|
|
37
|
+
[240]:https://github.com/rgrove/sanitize/pull/240
|
|
38
|
+
|
|
39
|
+
## 6.1.1 (2024-06-12)
|
|
40
|
+
|
|
41
|
+
### Bug Fixes
|
|
42
|
+
|
|
43
|
+
* 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][238]
|
|
44
|
+
|
|
45
|
+
[238]:https://github.com/rgrove/sanitize/pull/238
|
|
46
|
+
|
|
47
|
+
## 6.1.0 (2023-09-14)
|
|
48
|
+
|
|
49
|
+
### Features
|
|
50
|
+
|
|
51
|
+
* Added the `text-decoration-skip-ink` and `text-decoration-thickness` CSS properties to the relaxed config. [@martineriksson - #228][228]
|
|
52
|
+
|
|
53
|
+
[228]:https://github.com/rgrove/sanitize/pull/228
|
|
2
54
|
|
|
3
55
|
## 6.0.2 (2023-07-06)
|
|
4
56
|
|
|
@@ -247,8 +299,6 @@ review the changes below carefully.
|
|
|
247
299
|
Many thanks to the Shopify Application Security Team for responsibly reporting
|
|
248
300
|
this issue.
|
|
249
301
|
|
|
250
|
-
[176]:https://github.com/rgrove/sanitize/issues/176
|
|
251
|
-
|
|
252
302
|
## 4.6.2 (2018-03-19)
|
|
253
303
|
|
|
254
304
|
* Reduced string allocations to optimize memory usage. [@janklimo - #175][175]
|
|
@@ -586,7 +636,7 @@ Sanitize.fragment(html, Sanitize::Config.merge(Sanitize::Config::BASIC,
|
|
|
586
636
|
## 2.0.4 (2013-06-12)
|
|
587
637
|
|
|
588
638
|
* Added `Sanitize.clean_document`, which sanitizes a full HTML document rather
|
|
589
|
-
than just a fragment. [Ben Anderson]
|
|
639
|
+
than just a fragment. \[Ben Anderson]
|
|
590
640
|
|
|
591
641
|
* Nokogiri dependency bumped to 1.6.x.
|
|
592
642
|
|
|
@@ -609,7 +659,7 @@ Sanitize.fragment(html, Sanitize::Config.merge(Sanitize::Config::BASIC,
|
|
|
609
659
|
## 2.0.1 (2011-03-16)
|
|
610
660
|
|
|
611
661
|
* Updated the protocol regex to anchor at the beginning of the string rather
|
|
612
|
-
than the beginning of a line. [Eaden McKee]
|
|
662
|
+
than the beginning of a line. \[Eaden McKee]
|
|
613
663
|
|
|
614
664
|
|
|
615
665
|
## 2.0.0 (2011-01-15)
|
|
@@ -655,7 +705,7 @@ Sanitize.fragment(html, Sanitize::Config.merge(Sanitize::Config::BASIC,
|
|
|
655
705
|
remove the contents of all non-allowlisted elements in addition to the
|
|
656
706
|
elements themselves. If set to an array of element names, Sanitize will
|
|
657
707
|
remove the contents of only those elements (when filtered), and leave the
|
|
658
|
-
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
|
|
659
709
|
option]
|
|
660
710
|
|
|
661
711
|
* Added an `:output_encoding` config setting to allow the character encoding
|
|
@@ -680,27 +730,27 @@ Sanitize.fragment(html, Sanitize::Config.merge(Sanitize::Config::BASIC,
|
|
|
680
730
|
* Added `Sanitize.clean_node!`, which sanitizes a `Nokogiri::XML::Node` and
|
|
681
731
|
all its children.
|
|
682
732
|
|
|
683
|
-
* Added elements `<h1>` through `<h6>` to the Relaxed allowlist. [Suggested by
|
|
733
|
+
* Added elements `<h1>` through `<h6>` to the Relaxed allowlist. \[Suggested by
|
|
684
734
|
David Reese]
|
|
685
735
|
|
|
686
736
|
|
|
687
737
|
## 1.1.0 (2009-10-11)
|
|
688
738
|
|
|
689
|
-
* 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]
|
|
690
740
|
|
|
691
741
|
* Added an `:output` config setting to allow the output format to be
|
|
692
742
|
specified. Supported formats are `:xhtml` (the default) and `:html` (which
|
|
693
743
|
outputs HTML4).
|
|
694
744
|
|
|
695
745
|
* Changed protocol regex to ensure Sanitize doesn't kill URLs with colons in
|
|
696
|
-
path segments. [Peter Cooper]
|
|
746
|
+
path segments. \[Peter Cooper]
|
|
697
747
|
|
|
698
748
|
|
|
699
749
|
## 1.0.8 (2009-04-23)
|
|
700
750
|
|
|
701
751
|
* Added a workaround for an Hpricot bug that prevents attribute names from
|
|
702
752
|
being downcased in recent versions of Hpricot. This was exploitable to
|
|
703
|
-
prevent non-allowlisted protocols from being cleaned. [Reported by Ben
|
|
753
|
+
prevent non-allowlisted protocols from being cleaned. \[Reported by Ben
|
|
704
754
|
Wanicur]
|
|
705
755
|
|
|
706
756
|
|
|
@@ -709,7 +759,7 @@ Sanitize.fragment(html, Sanitize::Config.merge(Sanitize::Config::BASIC,
|
|
|
709
759
|
* Requires Hpricot 0.8.1+, which is finally compatible with Ruby 1.9.1.
|
|
710
760
|
|
|
711
761
|
* Fixed a bug that caused named character entities containing digits (like
|
|
712
|
-
`²`) to be escaped when they shouldn't have been. [Reported by
|
|
762
|
+
`²`) to be escaped when they shouldn't have been. \[Reported by
|
|
713
763
|
Sebastian Steinmetz]
|
|
714
764
|
|
|
715
765
|
|
|
@@ -724,14 +774,14 @@ Sanitize.fragment(html, Sanitize::Config.merge(Sanitize::Config::BASIC,
|
|
|
724
774
|
problems in IE6.
|
|
725
775
|
|
|
726
776
|
* You can now specify the symbol `:all` in place of an element name in the
|
|
727
|
-
attributes config hash to allow certain attributes on all elements. [Thanks
|
|
777
|
+
attributes config hash to allow certain attributes on all elements. \[Thanks
|
|
728
778
|
to Mutwin Kraus]
|
|
729
779
|
|
|
730
780
|
|
|
731
781
|
## 1.0.5 (2009-02-05)
|
|
732
782
|
|
|
733
783
|
* Fixed a bug introduced in version 1.0.3 that prevented non-allowlisted
|
|
734
|
-
protocols from being cleaned when relative URLs were allowed. [Reported by
|
|
784
|
+
protocols from being cleaned when relative URLs were allowed. \[Reported by
|
|
735
785
|
Dev Purkayastha]
|
|
736
786
|
|
|
737
787
|
* Fixed "undefined method `parent='" exceptions caused by parser changes in
|
|
@@ -742,7 +792,7 @@ Sanitize.fragment(html, Sanitize::Config.merge(Sanitize::Config::BASIC,
|
|
|
742
792
|
|
|
743
793
|
* Fixed a bug that made it possible to sneak a non-allowlisted element through
|
|
744
794
|
by repeating it several times in a row. All versions of Sanitize prior to
|
|
745
|
-
1.0.4 are vulnerable. [Reported by Cristobal]
|
|
795
|
+
1.0.4 are vulnerable. \[Reported by Cristobal]
|
|
746
796
|
|
|
747
797
|
|
|
748
798
|
## 1.0.3 (2009-01-15)
|
data/LICENSE
CHANGED