sanitize 6.0.1 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 819d713b2d4a78519e8bd4f2f853d6558d93ffd2d0481e10d012d8f74afbb555
4
- data.tar.gz: 04a48476bf940cfffc12654e71d60a95fd93c0576b6bec6870c2defb5b72fa90
3
+ metadata.gz: 10cf123f7eaed8a285ff4e7bae8505fb8a9af67dc523c3b5e4bd12a4dced17d6
4
+ data.tar.gz: bdf948795e0ddd9dd1ab4c725395e91e2862b7fd5a38260c41c698774a6c04c4
5
5
  SHA512:
6
- metadata.gz: ed59ea47cc4a620ccf61be3443ef97036a877903bbc90fa855936e57446e34b92f5b9eb41ed9a026e17779fa473ce10d066986c1dd986c58381dae22bb7c9905
7
- data.tar.gz: 27b40d2033ecd346c299bb77a7788b5325b79edd39c4767c9e5bf27486cf29bf2a5f3b34f96def645bbefd325b0e51a27182b75f187d2eb00931542769cd8c37
6
+ metadata.gz: 19865991970865b794d40c357464b40a34bc405a9c5e5426a7ea69d6435b38ece6bdeeca9e3c12c0abdd1869a7a3a814b11bd937d445c3d003a0174d22c80969
7
+ data.tar.gz: 641dbdbccc41c7e7d6765e8f1abdea8c16ace06e79233cca757a0a7018827340084f6417ec24469b8fab23363e82894526b3d9523e4dfc8cf089fcb5e164ec55
data/HISTORY.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Sanitize History
2
2
 
3
+ ## 6.1.0 (2023-09-14)
4
+
5
+ ### Features
6
+
7
+ * Added the `text-decoration-skip-ink` and `text-decoration-thickness` CSS properties to the relaxed config. [@martineriksson - #228][228]
8
+
9
+ [228]:https://github.com/rgrove/sanitize/pull/228
10
+
11
+ ## 6.0.2 (2023-07-06)
12
+
13
+ ### Bug Fixes
14
+
15
+ * CVE-2023-36823: Fixed an HTML+CSS sanitization bypass that could allow XSS
16
+ (cross-site scripting). This issue affects Sanitize versions 3.0.0 through
17
+ 6.0.1.
18
+
19
+ When using Sanitize's relaxed config or a custom config that allows `<style>`
20
+ elements and one or more CSS at-rules, carefully crafted input could be used
21
+ to sneak arbitrary HTML through Sanitize.
22
+
23
+ See the following security advisory for additional details:
24
+ [GHSA-f5ww-cq3m-q3g7](https://github.com/rgrove/sanitize/security/advisories/GHSA-f5ww-cq3m-q3g7)
25
+
26
+ Thanks to @cure53 for finding this issue.
27
+
3
28
  ## 6.0.1 (2023-01-27)
4
29
 
5
30
  ### Bug Fixes
@@ -666,7 +666,9 @@ class Sanitize
666
666
  text-decoration-color
667
667
  text-decoration-line
668
668
  text-decoration-skip
669
+ text-decoration-skip-ink
669
670
  text-decoration-style
671
+ text-decoration-thickness
670
672
  text-emphasis
671
673
  text-emphasis-color
672
674
  text-emphasis-position
@@ -48,6 +48,7 @@ class CleanElement
48
48
  if css.strip.empty?
49
49
  node.unlink
50
50
  else
51
+ css.gsub!('</', '<\/')
51
52
  node.children.unlink
52
53
  node << Nokogiri::XML::Text.new(css, node.document)
53
54
  end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  class Sanitize
4
- VERSION = '6.0.1'
2
+ VERSION = '6.1.0'
5
3
  end
@@ -39,4 +39,17 @@ describe 'Malicious CSS' do
39
39
  it 'should not allow behaviors' do
40
40
  _(@s.properties(%[behavior: url(xss.htc);])).must_equal ''
41
41
  end
42
+
43
+ describe 'sanitization bypass via CSS at-rule in HTML <style> element' do
44
+ before do
45
+ @s = Sanitize.new(Sanitize::Config::RELAXED)
46
+ end
47
+
48
+ it 'is not possible to prematurely end a <style> element' do
49
+ assert_equal(
50
+ %[<style>@media<\\/style><iframe srcdoc='<script>alert(document.domain)<\\/script>'>{}</style>],
51
+ @s.fragment(%[<style>@media</sty/**/le><iframe srcdoc='<script>alert(document.domain)</script>'></style>])
52
+ )
53
+ end
54
+ end
42
55
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sanitize
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.1
4
+ version: 6.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Grove
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-27 00:00:00.000000000 Z
11
+ date: 2023-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: crass
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  - !ruby/object:Gem::Version
122
122
  version: 1.2.0
123
123
  requirements: []
124
- rubygems_version: 3.4.1
124
+ rubygems_version: 3.4.10
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: Allowlist-based HTML and CSS sanitizer.