loofah 2.2.2 → 2.2.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of loofah might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9445f9115cb9fbe0677be8a93170729ddc04cfaa
4
- data.tar.gz: b39cfde37a7ee10027da8e29052785b41965299e
2
+ SHA256:
3
+ metadata.gz: c22c1a749ff878b96f0c4a53e789834fa8072775c5abdccb68c388d6218b1bce
4
+ data.tar.gz: e8d00e6ff5d623b3f3d03ce83ee780a88e92138fcb71efff28194f8a7d87e5fc
5
5
  SHA512:
6
- metadata.gz: ffb7c7bdec7a1fb813ccd81d8841779d57304d32e7b34f99d3bdec2407aafd96562d7a15a8758b0abe63dbbb8b1b078b396ab5ce55ed2a168f5f8fff4dce5c50
7
- data.tar.gz: 3ed294bf7beaeb073c688a46c8bbc2d6ef870afe09e1ca0c09ad144b93f06ef02638757176a53baf86eb3f1311833acf18fe94f47ad8d55d63302fb19c7ec666
6
+ metadata.gz: 0d5a0160010d61a51dad8e31bc644e03454311b99b1d71c6eaea5458cfaaa228671b82db52cf2369b42c48b636b912ca0d812191ac886a5c1499c44fc5221239
7
+ data.tar.gz: ac479e283ef08b0df14938ec577a3aa4008d07ba3288232541928794cd0b9fe2512da88ac7fd2d123666dcad67d09c1a07307442610f61adbfd65f143ae339b5
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.2.3 / 2018-10-30
4
+
5
+ ### Security
6
+
7
+ Address CVE-2018-16468: Unsanitized JavaScript may occur in sanitized output when a crafted SVG element is republished.
8
+
9
+ This CVE's public notice is at https://github.com/flavorjones/loofah/issues/154
10
+
11
+
12
+ ## Meta / 2018-10-27
13
+
14
+ The mailing list is now on Google Groups [#146](https://github.com/flavorjones/loofah/issues/146):
15
+
16
+ * Mail: loofah-talk@googlegroups.com
17
+ * Archive: https://groups.google.com/forum/#!forum/loofah-talk
18
+
19
+ This change was made because librelist no longer appears to be maintained.
20
+
21
+
3
22
  ## 2.2.2 / 2018-03-22
4
23
 
5
24
  Make public `Loofah::HTML5::Scrub.force_correct_attribute_escaping!`,
@@ -10,6 +29,8 @@ attribute scrubbers should they need to address CVE-2018-8048.
10
29
 
11
30
  ## 2.2.1 / 2018-03-19
12
31
 
32
+ ### Security
33
+
13
34
  Addresses CVE-2018-8048. Loofah allowed non-whitelisted attributes to be present in sanitized output when input with specially-crafted HTML fragments.
14
35
 
15
36
  This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
@@ -17,7 +38,7 @@ This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
17
38
 
18
39
  ## 2.2.0 / 2018-02-11
19
40
 
20
- Features:
41
+ ### Features:
21
42
 
22
43
  * Support HTML5 `<main>` tag. #133 (Thanks, @MothOnMars!)
23
44
  * Recognize HTML5 block elements. #136 (Thanks, @MothOnMars!)
@@ -25,32 +46,32 @@ Features:
25
46
  * Support for whitelisting CSS functions, initially just `calc` and `rgb`. #122/#123/#129 (Thanks, @NikoRoberts!)
26
47
  * Whitelist CSS property `list-style-type`. #68/#137/#142 (Thanks, @andela-ysanni and @NikoRoberts!)
27
48
 
28
- Bugfixes:
49
+ ### Bugfixes:
29
50
 
30
51
  * Properly handle nested `script` tags. #127.
31
52
 
32
53
 
33
54
  ## 2.1.1 / 2017-09-24
34
55
 
35
- Bugfixes:
56
+ ### Bugfixes:
36
57
 
37
58
  * Removed warning for unused variable. #124 (Thanks, @y-yagi!)
38
59
 
39
60
 
40
61
  ## 2.1.0 / 2017-09-24
41
62
 
42
- Notes:
63
+ ### Notes:
43
64
 
44
65
  * Re-implemented CSS parsing and sanitization using the [crass](https://github.com/rgrove/crass) library. #91
45
66
 
46
67
 
47
- Features:
68
+ ### Features:
48
69
 
49
70
  * Added :noopener HTML scrubber (Thanks, @tastycode!)
50
71
  * Support `data` URIs with the following media types: text/plain, text/css, image/png, image/gif, image/jpeg, image/svg+xml. #101, #120. (Thanks, @mrpasquini!)
51
72
 
52
73
 
53
- Bugfixes:
74
+ ### Bugfixes:
54
75
 
55
76
  * The :unprintable scrubber now scrubs unprintable characters in CDATA nodes (like `<script>`). #124
56
77
  * Allow negative values in CSS properties. Restores functionality that was reverted in v2.0.3. #91
@@ -58,14 +79,14 @@ Bugfixes:
58
79
 
59
80
  ## 2.0.3 / 2015-08-17
60
81
 
61
- Bug fixes:
82
+ ### Bug fixes:
62
83
 
63
84
  * Revert support for negative values in CSS properties due to slow performance. #90 (Related to #85.)
64
85
 
65
86
 
66
87
  ## 2.0.2 / 2015-05-05
67
88
 
68
- Bug fixes:
89
+ ### Bug fixes:
69
90
 
70
91
  * Fix error with `#to_text` when Loofah::Helpers hadn't been required. #75
71
92
  * Allow multi-word data attributes. #84 (Thanks, @jstorimer!)
@@ -74,24 +95,24 @@ Bug fixes:
74
95
 
75
96
  ## 2.0.1 / 2014-08-21
76
97
 
77
- Bug fixes:
98
+ ### Bug fixes:
78
99
 
79
100
  * Load RR correctly when running test files directly. (Thanks, @ktdreyer!)
80
101
 
81
102
 
82
- Notes:
103
+ ### Notes:
83
104
 
84
105
  * Extracted HTML5::Scrub#scrub_css_attribute to accommodate the Rails integration work. (Thanks, @kaspth!)
85
106
 
86
107
 
87
108
  ## 2.0.0 / 2014-05-09
88
109
 
89
- Compatibility notes:
110
+ ### Compatibility notes:
90
111
 
91
112
  * ActionView helpers now must be required explicitly: `require "loofah/helpers"`
92
113
  * Support for Ruby 1.8.7 and prior has been dropped
93
114
 
94
- Enhancements:
115
+ ### Enhancements:
95
116
 
96
117
  * HTML5 whitelist allows the following ...
97
118
  * tags: `article`, `aside`, `bdi`, `bdo`, `canvas`, `command`, `datalist`, `details`, `figcaption`, `figure`, `footer`, `header`, `mark`, `meter`, `nav`, `output`, `section`, `summary`, `time`
@@ -101,7 +122,7 @@ Enhancements:
101
122
  * `Loofah.fragment` accepts an optional encoding argument, compatible with `Nokogiri::HTML::DocumentFragment.parse`. #62 (Thanks, Ben Atkins!)
102
123
  * HTML5 sanitizers now remove attributes without values. (Thanks, Kasper Timm Hansen!)
103
124
 
104
- Bug fixes:
125
+ ### Bug fixes:
105
126
 
106
127
  * HTML5 sanitizers' CSS keyword check now actually works (broken in v2.0). Additional regression tests added. (Thanks, Kasper Timm Hansen!)
107
128
  * HTML5 sanitizers now allow negative arguments to CSS. #64 (Thanks, Jon Calhoun!)
@@ -114,7 +135,7 @@ Bug fixes:
114
135
 
115
136
  ## 1.2.0 (2011-08-08)
116
137
 
117
- Enhancements:
138
+ ### Enhancements:
118
139
 
119
140
  * Loofah::Helpers.sanitize_css is a replacement for Rails's built-in sanitize_css helper.
120
141
  * Improving ActionView integration.
@@ -122,7 +143,7 @@ Enhancements:
122
143
 
123
144
  ## 1.1.0 (2011-08-08)
124
145
 
125
- Enhancements:
146
+ ### Enhancements:
126
147
 
127
148
  * Additional HTML5lib whitelist elements (from html5lib 1524:80b5efe26230).
128
149
  Up to date with HTML5lib ruby code as of 1723:7ee6a0331856.
@@ -132,7 +153,7 @@ Enhancements:
132
153
 
133
154
  ## 1.0.0 (2010-10-26)
134
155
 
135
- Notes:
156
+ ### Notes:
136
157
 
137
158
  * Moved ActiveRecord functionality into `loofah-activerecord` gem.
138
159
  * Removed DEPRECATIONS.rdoc documenting 0.3.0 API changes.
@@ -140,7 +161,7 @@ Notes:
140
161
 
141
162
  ## 0.4.7 (2010-03-09)
142
163
 
143
- Enhancements:
164
+ ### Enhancements:
144
165
 
145
166
  * New methods Loofah::HTML::Document#to_text and
146
167
  Loofah::HTML::DocumentFragment#to_text do the right thing with
@@ -153,23 +174,23 @@ Enhancements:
153
174
 
154
175
  ## 0.4.4, 0.4.5, 0.4.6 (2010-02-01)
155
176
 
156
- Enhancements:
177
+ ### Enhancements:
157
178
 
158
179
  * Loofah::HTML::Document#text and Loofah::HTML::DocumentFragment#text now escape HTML entities.
159
180
 
160
- Bug fixes:
181
+ ### Bug fixes:
161
182
 
162
183
  * Loofah::XssFoliate was not properly escaping HTML entities when implicitly scrubbing a string attribute. GH #17
163
184
 
164
185
 
165
186
  ## 0.4.3 (2010-01-29)
166
187
 
167
- Enhancements:
188
+ ### Enhancements:
168
189
 
169
190
  * All built-in scrubbers are accepted by ActiveRecord::Base.xss_foliate
170
191
  * Loofah::XssFoliate.xss_foliate_all_models replaces use of the constant LOOFAH_XSS_FOLIATE_ALL_MODELS
171
192
 
172
- Miscellaneous:
193
+ ### Miscellaneous:
173
194
 
174
195
  * Modified documentation for bootstrapping XssFoliate in a Rails app,
175
196
  since the use of Bundler breaks the previously-documented method. To
@@ -178,18 +199,18 @@ Miscellaneous:
178
199
 
179
200
  ## 0.4.2 (2010-01-22)
180
201
 
181
- Enhancements:
202
+ ### Enhancements:
182
203
 
183
204
  * Implemented Node#scrub! for scrubbing subtrees.
184
205
  * Implemented NodeSet#scrub! for scrubbing a set of subtrees.
185
206
  * Document.text now only serializes <body> contents (ignores <head>)
186
207
  * <head>, <html> and <body> added to the HTML5lib whitelist.
187
208
 
188
- Bug fixes:
209
+ ### Bug fixes:
189
210
 
190
211
  * Supporting Rails apps that aren't loading ActiveRecord. GH #10
191
212
 
192
- Miscellaneous:
213
+ ### Miscellaneous:
193
214
 
194
215
  * Mailing list is now loofah@librelist.com / http://librelist.com
195
216
  * IRC channel is now \#loofah on freenode.
@@ -197,14 +218,14 @@ Miscellaneous:
197
218
 
198
219
  ## 0.4.1 (2009-11-23)
199
220
 
200
- Bugfix:
221
+ ### Bugfix:
201
222
 
202
223
  * Manifest fixed. Whoops.
203
224
 
204
225
 
205
226
  ## 0.4.0 (2009-11-21)
206
227
 
207
- Enhancements:
228
+ ### Enhancements:
208
229
 
209
230
  * Scrubber class introduced, allowing development of custom scrubbers.
210
231
  * Added support for XML documents and fragments.
@@ -215,20 +236,20 @@ Enhancements:
215
236
 
216
237
  ## 0.3.1 (2009-10-12)
217
238
 
218
- Bug fixes:
239
+ ### Bug fixes:
219
240
 
220
241
  * Scrubbed Documents properly render html, head and body tags when serialized.
221
242
 
222
243
 
223
244
  ## 0.3.0 (2009-10-06)
224
245
 
225
- Enhancements:
246
+ ### Enhancements:
226
247
 
227
248
  * New ActiveRecord extension `xss_foliate`, a drop-in replacement for xss_terminate[http://github.com/look/xss_terminate/tree/master].
228
249
  * Replacement methods for Rails's helpers, Loofah::Rails.sanitize and Loofah::Rails.strip_tags.
229
250
  * Official support (and test coverage) for Rails versions 2.3, 2.2, 2.1, 2.0 and 1.2.
230
251
 
231
- Deprecations:
252
+ ### Deprecations:
232
253
 
233
254
  * The methods strip_tags, whitewash, whitewash_document, sanitize, and
234
255
  sanitize_document have been deprecated. See DEPRECATED.rdoc for
@@ -237,7 +258,7 @@ Deprecations:
237
258
 
238
259
  ## 0.2.2 (2009-09-30)
239
260
 
240
- Enhancements:
261
+ ### Enhancements:
241
262
 
242
263
  * ActiveRecord extension scrubs fields in a before_validation callback
243
264
  (was previously in a before_save)
@@ -245,12 +266,12 @@ Enhancements:
245
266
 
246
267
  ## 0.2.1 (2009-09-19)
247
268
 
248
- Enhancements:
269
+ ### Enhancements:
249
270
 
250
271
  * when loaded in a Rails app, automatically extend ActiveRecord::Base
251
272
  with html_fragment and html_document. GH #6 (Thanks Josh Nichols!)
252
273
 
253
- Bugfixes:
274
+ ### Bugfixes:
254
275
 
255
276
  * ActiveRecord scrubbing should generate strings instead of Document or
256
277
  DocumentFragment objects. GH #5
@@ -24,6 +24,7 @@ lib/loofah/scrubber.rb
24
24
  lib/loofah/scrubbers.rb
25
25
  lib/loofah/xml/document.rb
26
26
  lib/loofah/xml/document_fragment.rb
27
+ test/assets/msword.html
27
28
  test/assets/testdata_sanitizer_tests1.dat
28
29
  test/helper.rb
29
30
  test/html5/test_sanitizer.rb
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Loofah
2
2
 
3
3
  * https://github.com/flavorjones/loofah
4
- * http://rubydoc.info/github/flavorjones/loofah/master/frames
5
- * http://librelist.com/browser/loofah
4
+ * Docs: http://rubydoc.info/github/flavorjones/loofah/master/frames
5
+ * Mailing list: [loofah-talk@googlegroups.com](https://groups.google.com/forum/#!forum/loofah-talk)
6
6
 
7
7
  ## Status
8
8
 
@@ -301,9 +301,10 @@ The bug tracker is available here:
301
301
 
302
302
  * https://github.com/flavorjones/loofah/issues
303
303
 
304
- And the mailing list is on librelist:
304
+ And the mailing list is on Google Groups:
305
305
 
306
- * loofah@librelist.com / http://librelist.com
306
+ * Mail: loofah-talk@googlegroups.com
307
+ * Archive: https://groups.google.com/forum/#!forum/loofah-talk
307
308
 
308
309
  And the IRC channel is \#loofah on freenode.
309
310
 
@@ -9,7 +9,7 @@ Your report will be acknowledged within 24 hours, and you'll receive a more deta
9
9
  If you have not received a reply to your submission within 48 hours, there are a few steps you can take:
10
10
 
11
11
  * Contact the current security coordinator (Mike Dalessio <mike.dalessio@gmail.com>)
12
- * Email the Loofah user group at loofah@librelist.com (archive at http://librelist.com)
12
+ * Email the Loofah user group at loofah-talk@googlegroups.com (archive at https://groups.google.com/forum/#!forum/loofah-talk)
13
13
 
14
14
  Please note, the user group list is a public area. When escalating in that venue, please do not discuss your issue. Simply say that you're trying to get a hold of someone from the core team.
15
15
 
@@ -28,7 +28,7 @@ require 'loofah/html/document_fragment'
28
28
  #
29
29
  module Loofah
30
30
  # The version of Loofah you are using
31
- VERSION = '2.2.2'
31
+ VERSION = '2.2.3'
32
32
 
33
33
  class << self
34
34
  # Shortcut for Loofah::HTML::Document.parse
@@ -92,7 +92,7 @@ module Loofah
92
92
  color-interpolation-filters color-rendering content cx cy d dx
93
93
  dy descent display dur end fill fill-opacity fill-rule
94
94
  filterRes filterUnits font-family
95
- font-size font-stretch font-style font-variant font-weight from fx fy g1
95
+ font-size font-stretch font-style font-variant font-weight fx fy g1
96
96
  g2 glyph-name gradientUnits hanging height horiz-adv-x horiz-origin-x id
97
97
  ideographic k keyPoints keySplines keyTimes lang marker-end
98
98
  marker-mid marker-start markerHeight markerUnits markerWidth
@@ -0,0 +1,63 @@
1
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 11"><meta name="Originator" content="Microsoft Word 11"><link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CNICOLE%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"><!--[if gte mso 9]><xml>
2
+ <w:WordDocument>
3
+ <w:View>Normal</w:View>
4
+ <w:Zoom>0</w:Zoom>
5
+ <w:PunctuationKerning/>
6
+ <w:ValidateAgainstSchemas/>
7
+ <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
8
+ <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
9
+ <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
10
+ <w:Compatibility>
11
+ <w:BreakWrappedTables/>
12
+ <w:SnapToGridInCell/>
13
+ <w:WrapTextWithPunct/>
14
+ <w:UseAsianBreakRules/>
15
+ <w:DontGrowAutofit/>
16
+ </w:Compatibility>
17
+ <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
18
+ </w:WordDocument>
19
+ </xml><![endif]--><!--[if gte mso 9]><xml>
20
+ <w:LatentStyles DefLockedState="false" LatentStyleCount="156">
21
+ </w:LatentStyles>
22
+ </xml><![endif]--><style>
23
+ <!--
24
+ /* Style Definitions */
25
+ p.MsoNormal, li.MsoNormal, div.MsoNormal
26
+ {mso-style-parent:"";
27
+ margin:0in;
28
+ margin-bottom:.0001pt;
29
+ mso-pagination:widow-orphan;
30
+ font-size:12.0pt;
31
+ font-family:"Times New Roman";
32
+ mso-fareast-font-family:"Times New Roman";}
33
+ @page Section1
34
+ {size:8.5in 11.0in;
35
+ margin:1.0in 1.25in 1.0in 1.25in;
36
+ mso-header-margin:.5in;
37
+ mso-footer-margin:.5in;
38
+ mso-paper-source:0;}
39
+ div.Section1
40
+ {page:Section1;}
41
+ -->
42
+ </style><!--[if gte mso 10]>
43
+ <style>
44
+ /* Style Definitions */
45
+ table.MsoNormalTable
46
+ {mso-style-name:"Table Normal";
47
+ mso-tstyle-rowband-size:0;
48
+ mso-tstyle-colband-size:0;
49
+ mso-style-noshow:yes;
50
+ mso-style-parent:"";
51
+ mso-padding-alt:0in 5.4pt 0in 5.4pt;
52
+ mso-para-margin:0in;
53
+ mso-para-margin-bottom:.0001pt;
54
+ mso-pagination:widow-orphan;
55
+ font-size:10.0pt;
56
+ font-family:"Times New Roman";
57
+ mso-ansi-language:#0400;
58
+ mso-fareast-language:#0400;
59
+ mso-bidi-language:#0400;}
60
+ </style>
61
+ <![endif]-->
62
+
63
+ <p class="MsoNormal">Foo <b style="">BOLD<o:p></o:p></b></p>
@@ -17,6 +17,8 @@ class IntegrationTestAdHoc < Loofah::TestCase
17
17
  end
18
18
 
19
19
  context "tests" do
20
+ MSWORD_HTML = File.read(File.join(File.dirname(__FILE__), "..", "assets", "msword.html")).freeze
21
+
20
22
  def test_removal_of_illegal_tag
21
23
  html = <<-HTML
22
24
  following this there should be no jim tag
@@ -76,72 +78,6 @@ class IntegrationTestAdHoc < Loofah::TestCase
76
78
  assert_equal "<p>safe</p><b>description</b>", whitewashed.gsub("\n","")
77
79
  end
78
80
 
79
- MSWORD_HTML = <<-EOHTML
80
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 11"><meta name="Originator" content="Microsoft Word 11"><link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CNICOLE%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"><!--[if gte mso 9]><xml>
81
- <w:WordDocument>
82
- <w:View>Normal</w:View>
83
- <w:Zoom>0</w:Zoom>
84
- <w:PunctuationKerning/>
85
- <w:ValidateAgainstSchemas/>
86
- <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
87
- <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
88
- <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
89
- <w:Compatibility>
90
- <w:BreakWrappedTables/>
91
- <w:SnapToGridInCell/>
92
- <w:WrapTextWithPunct/>
93
- <w:UseAsianBreakRules/>
94
- <w:DontGrowAutofit/>
95
- </w:Compatibility>
96
- <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
97
- </w:WordDocument>
98
- </xml><![endif]--><!--[if gte mso 9]><xml>
99
- <w:LatentStyles DefLockedState="false" LatentStyleCount="156">
100
- </w:LatentStyles>
101
- </xml><![endif]--><style>
102
- <!--
103
- /* Style Definitions */
104
- p.MsoNormal, li.MsoNormal, div.MsoNormal
105
- {mso-style-parent:"";
106
- margin:0in;
107
- margin-bottom:.0001pt;
108
- mso-pagination:widow-orphan;
109
- font-size:12.0pt;
110
- font-family:"Times New Roman";
111
- mso-fareast-font-family:"Times New Roman";}
112
- @page Section1
113
- {size:8.5in 11.0in;
114
- margin:1.0in 1.25in 1.0in 1.25in;
115
- mso-header-margin:.5in;
116
- mso-footer-margin:.5in;
117
- mso-paper-source:0;}
118
- div.Section1
119
- {page:Section1;}
120
- -->
121
- </style><!--[if gte mso 10]>
122
- <style>
123
- /* Style Definitions */
124
- table.MsoNormalTable
125
- {mso-style-name:"Table Normal";
126
- mso-tstyle-rowband-size:0;
127
- mso-tstyle-colband-size:0;
128
- mso-style-noshow:yes;
129
- mso-style-parent:"";
130
- mso-padding-alt:0in 5.4pt 0in 5.4pt;
131
- mso-para-margin:0in;
132
- mso-para-margin-bottom:.0001pt;
133
- mso-pagination:widow-orphan;
134
- font-size:10.0pt;
135
- font-family:"Times New Roman";
136
- mso-ansi-language:#0400;
137
- mso-fareast-language:#0400;
138
- mso-bidi-language:#0400;}
139
- </style>
140
- <![endif]-->
141
-
142
- <p class="MsoNormal">Foo <b style="">BOLD<o:p></o:p></b></p>
143
- EOHTML
144
-
145
81
  def test_fragment_whitewash_on_microsofty_markup
146
82
  whitewashed = Loofah.fragment(MSWORD_HTML).scrub!(:whitewash)
147
83
  assert_equal "<p>Foo <b>BOLD</b></p>", whitewashed.to_s.strip
@@ -252,7 +188,17 @@ mso-bidi-language:#0400;}
252
188
  assert_equal %{examp<!--%22 unsafeattr=foo()>-->le.com}, attributes.first.value
253
189
  end
254
190
  end
191
+ end
255
192
 
193
+ # see:
194
+ # - https://github.com/flavorjones/loofah/issues/154
195
+ # - https://hackerone.com/reports/429267
196
+ context "xss protection from svg xmlns:xlink animate attribute" do
197
+ it "sanitizes appropriate attributes" do
198
+ html = %Q{<svg><a xmlns:xlink=http://www.w3.org/1999/xlink xlink:href=?><circle r=400 /><animate attributeName=xlink:href begin=0 from=javascript:alert(1) to=%26>}
199
+ sanitized = Loofah.scrub_fragment(html, :escape)
200
+ assert_nil sanitized.at_css("animate")["from"]
201
+ end
256
202
  end
257
203
  end
258
204
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loofah
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Dalessio
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-03-22 00:00:00.000000000 Z
12
+ date: 2018-10-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -169,30 +169,36 @@ dependencies:
169
169
  name: rdoc
170
170
  requirement: !ruby/object:Gem::Requirement
171
171
  requirements:
172
- - - "~>"
172
+ - - ">="
173
173
  - !ruby/object:Gem::Version
174
174
  version: '4.0'
175
+ - - "<"
176
+ - !ruby/object:Gem::Version
177
+ version: '7'
175
178
  type: :development
176
179
  prerelease: false
177
180
  version_requirements: !ruby/object:Gem::Requirement
178
181
  requirements:
179
- - - "~>"
182
+ - - ">="
180
183
  - !ruby/object:Gem::Version
181
184
  version: '4.0'
185
+ - - "<"
186
+ - !ruby/object:Gem::Version
187
+ version: '7'
182
188
  - !ruby/object:Gem::Dependency
183
189
  name: hoe
184
190
  requirement: !ruby/object:Gem::Requirement
185
191
  requirements:
186
192
  - - "~>"
187
193
  - !ruby/object:Gem::Version
188
- version: '3.16'
194
+ version: '3.17'
189
195
  type: :development
190
196
  prerelease: false
191
197
  version_requirements: !ruby/object:Gem::Requirement
192
198
  requirements:
193
199
  - - "~>"
194
200
  - !ruby/object:Gem::Version
195
- version: '3.16'
201
+ version: '3.17'
196
202
  description: |-
197
203
  Loofah is a general library for manipulating and transforming HTML/XML
198
204
  documents and fragments. It's built on top of Nokogiri and libxml2, so
@@ -243,6 +249,7 @@ files:
243
249
  - lib/loofah/scrubbers.rb
244
250
  - lib/loofah/xml/document.rb
245
251
  - lib/loofah/xml/document_fragment.rb
252
+ - test/assets/msword.html
246
253
  - test/assets/testdata_sanitizer_tests1.dat
247
254
  - test/helper.rb
248
255
  - test/html5/test_sanitizer.rb
@@ -278,7 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
278
285
  version: '0'
279
286
  requirements: []
280
287
  rubyforge_project:
281
- rubygems_version: 2.6.12
288
+ rubygems_version: 2.7.7
282
289
  signing_key:
283
290
  specification_version: 4
284
291
  summary: Loofah is a general library for manipulating and transforming HTML/XML documents