loofah 2.2.0 → 2.3.0

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: 6656f9e5edc815b2c5ee676d1c4fb818b2dc03f4
4
- data.tar.gz: 7bea1d04f8af479fd825c7adf687f0ca0c624830
2
+ SHA256:
3
+ metadata.gz: 521948af26b151c0584b5eabd8e60c8c31ff451d2b134da4bc632256feeb87f4
4
+ data.tar.gz: 9b699d079c84a6c498fcb5be0e56f7c68ad7049bb0aa498e3413343803fcf585
5
5
  SHA512:
6
- metadata.gz: 42f030b7228867ebf322c9d8e286349e1288ef3d60f90fe404b0d9250cc626ea6fad84ff1325cd2754ea4a7fdf80802a4bdae5a9b7121ac312e56d96c280d1a3
7
- data.tar.gz: 8a67c56281a65b6e89d8623f40423ae41ed2628eeb0a90193196cfb87aeb4efccbe23c961b05ab26a247bac0117a55b68dea97ab6b67076e272ebad8471e33cb
6
+ metadata.gz: 7781d0db35620637fd69051e3729db36f4d10712bab60038df78f523d72b991b8e8f86009655495b56ef69d5b97aa5a621cc22698bc4eaec06577bece6841ec6
7
+ data.tar.gz: e42ab470cc2f3fbb5d0c3965b6a60fe698d0d076b3d87d58f6c4fa209531eac82188bef01c8005a94f3caa3f342ae7df4a850a4107fa043b618bdbd9f98c8d86
data/CHANGELOG.md CHANGED
@@ -1,8 +1,72 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.3.0 / unreleased
4
+
5
+ ### Features
6
+
7
+ * Expand set of allowed protocols to include `tel:` and `line:`. [#104, #147]
8
+ * Expand set of allowed CSS functions. [related to #122]
9
+ * Allow greater precision in shorthand CSS values. [#149] (Thanks, @danfstucky!)
10
+ * Allow CSS property `list-style` [#162] (Thanks, @jaredbeck!)
11
+ * Allow CSS keywords `thick` and `thin` [#168] (Thanks, @georgeclaghorn!)
12
+ * Allow HTML property `contenteditable` [#167] (Thanks, @andreynering!)
13
+
14
+
15
+ ### Bug fixes
16
+
17
+ * CSS hex values are no longer limited to lowercase hex. Previously uppercase hex were scrubbed. [#165] (Thanks, @asok!)
18
+
19
+
20
+ ### Deprecations / Name Changes
21
+
22
+ The following method and constants are hereby deprecated, and will be completely removed in a future release:
23
+
24
+ * Deprecate `Loofah::Helpers::ActionView.white_list_sanitizer`, please use `Loofah::Helpers::ActionView.safe_list_sanitizer` instead.
25
+ * Deprecate `Loofah::Helpers::ActionView::WhiteListSanitizer`, please use `Loofah::Helpers::ActionView::SafeListSanitizer` instead.
26
+ * Deprecate `Loofah::HTML5::WhiteList`, please use `Loofah::HTML5::SafeList` instead.
27
+
28
+ Thanks to @JuanitoFatas for submitting these changes in #164 and for making the language used in Loofah more inclusive.
29
+
30
+
31
+ ## 2.2.3 / 2018-10-30
32
+
33
+ ### Security
34
+
35
+ Address CVE-2018-16468: Unsanitized JavaScript may occur in sanitized output when a crafted SVG element is republished.
36
+
37
+ This CVE's public notice is at https://github.com/flavorjones/loofah/issues/154
38
+
39
+
40
+ ## Meta / 2018-10-27
41
+
42
+ The mailing list is now on Google Groups [#146](https://github.com/flavorjones/loofah/issues/146):
43
+
44
+ * Mail: loofah-talk@googlegroups.com
45
+ * Archive: https://groups.google.com/forum/#!forum/loofah-talk
46
+
47
+ This change was made because librelist no longer appears to be maintained.
48
+
49
+
50
+ ## 2.2.2 / 2018-03-22
51
+
52
+ Make public `Loofah::HTML5::Scrub.force_correct_attribute_escaping!`,
53
+ which was previously a private method. This is so that downstream gems
54
+ (like rails-html-sanitizer) can use this logic directly for their own
55
+ attribute scrubbers should they need to address CVE-2018-8048.
56
+
57
+
58
+ ## 2.2.1 / 2018-03-19
59
+
60
+ ### Security
61
+
62
+ Addresses CVE-2018-8048. Loofah allowed non-whitelisted attributes to be present in sanitized output when input with specially-crafted HTML fragments.
63
+
64
+ This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
65
+
66
+
3
67
  ## 2.2.0 / 2018-02-11
4
68
 
5
- Features:
69
+ ### Features:
6
70
 
7
71
  * Support HTML5 `<main>` tag. #133 (Thanks, @MothOnMars!)
8
72
  * Recognize HTML5 block elements. #136 (Thanks, @MothOnMars!)
@@ -10,32 +74,32 @@ Features:
10
74
  * Support for whitelisting CSS functions, initially just `calc` and `rgb`. #122/#123/#129 (Thanks, @NikoRoberts!)
11
75
  * Whitelist CSS property `list-style-type`. #68/#137/#142 (Thanks, @andela-ysanni and @NikoRoberts!)
12
76
 
13
- Bugfixes:
77
+ ### Bugfixes:
14
78
 
15
79
  * Properly handle nested `script` tags. #127.
16
80
 
17
81
 
18
82
  ## 2.1.1 / 2017-09-24
19
83
 
20
- Bugfixes:
84
+ ### Bugfixes:
21
85
 
22
86
  * Removed warning for unused variable. #124 (Thanks, @y-yagi!)
23
87
 
24
88
 
25
89
  ## 2.1.0 / 2017-09-24
26
90
 
27
- Notes:
91
+ ### Notes:
28
92
 
29
93
  * Re-implemented CSS parsing and sanitization using the [crass](https://github.com/rgrove/crass) library. #91
30
94
 
31
95
 
32
- Features:
96
+ ### Features:
33
97
 
34
98
  * Added :noopener HTML scrubber (Thanks, @tastycode!)
35
99
  * 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!)
36
100
 
37
101
 
38
- Bugfixes:
102
+ ### Bugfixes:
39
103
 
40
104
  * The :unprintable scrubber now scrubs unprintable characters in CDATA nodes (like `<script>`). #124
41
105
  * Allow negative values in CSS properties. Restores functionality that was reverted in v2.0.3. #91
@@ -43,14 +107,14 @@ Bugfixes:
43
107
 
44
108
  ## 2.0.3 / 2015-08-17
45
109
 
46
- Bug fixes:
110
+ ### Bug fixes:
47
111
 
48
112
  * Revert support for negative values in CSS properties due to slow performance. #90 (Related to #85.)
49
113
 
50
114
 
51
115
  ## 2.0.2 / 2015-05-05
52
116
 
53
- Bug fixes:
117
+ ### Bug fixes:
54
118
 
55
119
  * Fix error with `#to_text` when Loofah::Helpers hadn't been required. #75
56
120
  * Allow multi-word data attributes. #84 (Thanks, @jstorimer!)
@@ -59,24 +123,24 @@ Bug fixes:
59
123
 
60
124
  ## 2.0.1 / 2014-08-21
61
125
 
62
- Bug fixes:
126
+ ### Bug fixes:
63
127
 
64
128
  * Load RR correctly when running test files directly. (Thanks, @ktdreyer!)
65
129
 
66
130
 
67
- Notes:
131
+ ### Notes:
68
132
 
69
133
  * Extracted HTML5::Scrub#scrub_css_attribute to accommodate the Rails integration work. (Thanks, @kaspth!)
70
134
 
71
135
 
72
136
  ## 2.0.0 / 2014-05-09
73
137
 
74
- Compatibility notes:
138
+ ### Compatibility notes:
75
139
 
76
140
  * ActionView helpers now must be required explicitly: `require "loofah/helpers"`
77
141
  * Support for Ruby 1.8.7 and prior has been dropped
78
142
 
79
- Enhancements:
143
+ ### Enhancements:
80
144
 
81
145
  * HTML5 whitelist allows the following ...
82
146
  * tags: `article`, `aside`, `bdi`, `bdo`, `canvas`, `command`, `datalist`, `details`, `figcaption`, `figure`, `footer`, `header`, `mark`, `meter`, `nav`, `output`, `section`, `summary`, `time`
@@ -86,7 +150,7 @@ Enhancements:
86
150
  * `Loofah.fragment` accepts an optional encoding argument, compatible with `Nokogiri::HTML::DocumentFragment.parse`. #62 (Thanks, Ben Atkins!)
87
151
  * HTML5 sanitizers now remove attributes without values. (Thanks, Kasper Timm Hansen!)
88
152
 
89
- Bug fixes:
153
+ ### Bug fixes:
90
154
 
91
155
  * HTML5 sanitizers' CSS keyword check now actually works (broken in v2.0). Additional regression tests added. (Thanks, Kasper Timm Hansen!)
92
156
  * HTML5 sanitizers now allow negative arguments to CSS. #64 (Thanks, Jon Calhoun!)
@@ -99,7 +163,7 @@ Bug fixes:
99
163
 
100
164
  ## 1.2.0 (2011-08-08)
101
165
 
102
- Enhancements:
166
+ ### Enhancements:
103
167
 
104
168
  * Loofah::Helpers.sanitize_css is a replacement for Rails's built-in sanitize_css helper.
105
169
  * Improving ActionView integration.
@@ -107,7 +171,7 @@ Enhancements:
107
171
 
108
172
  ## 1.1.0 (2011-08-08)
109
173
 
110
- Enhancements:
174
+ ### Enhancements:
111
175
 
112
176
  * Additional HTML5lib whitelist elements (from html5lib 1524:80b5efe26230).
113
177
  Up to date with HTML5lib ruby code as of 1723:7ee6a0331856.
@@ -117,7 +181,7 @@ Enhancements:
117
181
 
118
182
  ## 1.0.0 (2010-10-26)
119
183
 
120
- Notes:
184
+ ### Notes:
121
185
 
122
186
  * Moved ActiveRecord functionality into `loofah-activerecord` gem.
123
187
  * Removed DEPRECATIONS.rdoc documenting 0.3.0 API changes.
@@ -125,7 +189,7 @@ Notes:
125
189
 
126
190
  ## 0.4.7 (2010-03-09)
127
191
 
128
- Enhancements:
192
+ ### Enhancements:
129
193
 
130
194
  * New methods Loofah::HTML::Document#to_text and
131
195
  Loofah::HTML::DocumentFragment#to_text do the right thing with
@@ -138,23 +202,23 @@ Enhancements:
138
202
 
139
203
  ## 0.4.4, 0.4.5, 0.4.6 (2010-02-01)
140
204
 
141
- Enhancements:
205
+ ### Enhancements:
142
206
 
143
207
  * Loofah::HTML::Document#text and Loofah::HTML::DocumentFragment#text now escape HTML entities.
144
208
 
145
- Bug fixes:
209
+ ### Bug fixes:
146
210
 
147
211
  * Loofah::XssFoliate was not properly escaping HTML entities when implicitly scrubbing a string attribute. GH #17
148
212
 
149
213
 
150
214
  ## 0.4.3 (2010-01-29)
151
215
 
152
- Enhancements:
216
+ ### Enhancements:
153
217
 
154
218
  * All built-in scrubbers are accepted by ActiveRecord::Base.xss_foliate
155
219
  * Loofah::XssFoliate.xss_foliate_all_models replaces use of the constant LOOFAH_XSS_FOLIATE_ALL_MODELS
156
220
 
157
- Miscellaneous:
221
+ ### Miscellaneous:
158
222
 
159
223
  * Modified documentation for bootstrapping XssFoliate in a Rails app,
160
224
  since the use of Bundler breaks the previously-documented method. To
@@ -163,18 +227,18 @@ Miscellaneous:
163
227
 
164
228
  ## 0.4.2 (2010-01-22)
165
229
 
166
- Enhancements:
230
+ ### Enhancements:
167
231
 
168
232
  * Implemented Node#scrub! for scrubbing subtrees.
169
233
  * Implemented NodeSet#scrub! for scrubbing a set of subtrees.
170
234
  * Document.text now only serializes <body> contents (ignores <head>)
171
235
  * <head>, <html> and <body> added to the HTML5lib whitelist.
172
236
 
173
- Bug fixes:
237
+ ### Bug fixes:
174
238
 
175
239
  * Supporting Rails apps that aren't loading ActiveRecord. GH #10
176
240
 
177
- Miscellaneous:
241
+ ### Miscellaneous:
178
242
 
179
243
  * Mailing list is now loofah@librelist.com / http://librelist.com
180
244
  * IRC channel is now \#loofah on freenode.
@@ -182,14 +246,14 @@ Miscellaneous:
182
246
 
183
247
  ## 0.4.1 (2009-11-23)
184
248
 
185
- Bugfix:
249
+ ### Bugfix:
186
250
 
187
251
  * Manifest fixed. Whoops.
188
252
 
189
253
 
190
254
  ## 0.4.0 (2009-11-21)
191
255
 
192
- Enhancements:
256
+ ### Enhancements:
193
257
 
194
258
  * Scrubber class introduced, allowing development of custom scrubbers.
195
259
  * Added support for XML documents and fragments.
@@ -200,20 +264,20 @@ Enhancements:
200
264
 
201
265
  ## 0.3.1 (2009-10-12)
202
266
 
203
- Bug fixes:
267
+ ### Bug fixes:
204
268
 
205
269
  * Scrubbed Documents properly render html, head and body tags when serialized.
206
270
 
207
271
 
208
272
  ## 0.3.0 (2009-10-06)
209
273
 
210
- Enhancements:
274
+ ### Enhancements:
211
275
 
212
276
  * New ActiveRecord extension `xss_foliate`, a drop-in replacement for xss_terminate[http://github.com/look/xss_terminate/tree/master].
213
277
  * Replacement methods for Rails's helpers, Loofah::Rails.sanitize and Loofah::Rails.strip_tags.
214
278
  * Official support (and test coverage) for Rails versions 2.3, 2.2, 2.1, 2.0 and 1.2.
215
279
 
216
- Deprecations:
280
+ ### Deprecations:
217
281
 
218
282
  * The methods strip_tags, whitewash, whitewash_document, sanitize, and
219
283
  sanitize_document have been deprecated. See DEPRECATED.rdoc for
@@ -222,7 +286,7 @@ Deprecations:
222
286
 
223
287
  ## 0.2.2 (2009-09-30)
224
288
 
225
- Enhancements:
289
+ ### Enhancements:
226
290
 
227
291
  * ActiveRecord extension scrubs fields in a before_validation callback
228
292
  (was previously in a before_save)
@@ -230,12 +294,12 @@ Enhancements:
230
294
 
231
295
  ## 0.2.1 (2009-09-19)
232
296
 
233
- Enhancements:
297
+ ### Enhancements:
234
298
 
235
299
  * when loaded in a Rails app, automatically extend ActiveRecord::Base
236
300
  with html_fragment and html_document. GH #6 (Thanks Josh Nichols!)
237
301
 
238
- Bugfixes:
302
+ ### Bugfixes:
239
303
 
240
304
  * ActiveRecord scrubbing should generate strings instead of Document or
241
305
  DocumentFragment objects. GH #5
data/Gemfile CHANGED
@@ -15,8 +15,8 @@ gem "hoe-gemspec", ">=0", :group => [:development, :test]
15
15
  gem "hoe-debugging", ">=0", :group => [:development, :test]
16
16
  gem "hoe-bundler", ">=0", :group => [:development, :test]
17
17
  gem "hoe-git", ">=0", :group => [:development, :test]
18
- gem "concourse", ">=0.15.0", :group => [:development, :test]
19
- gem "rdoc", "~>4.0", :group => [:development, :test]
20
- gem "hoe", "~>3.16", :group => [:development, :test]
18
+ gem "concourse", ">=0.26.0", :group => [:development, :test]
19
+ gem "rdoc", ">=4.0", "<7", :group => [:development, :test]
20
+ gem "hoe", "~>3.17", :group => [:development, :test]
21
21
 
22
22
  # vim: syntax=ruby
data/Manifest.txt CHANGED
@@ -5,6 +5,7 @@ MIT-LICENSE.txt
5
5
  Manifest.txt
6
6
  README.md
7
7
  Rakefile
8
+ SECURITY.md
8
9
  benchmark/benchmark.rb
9
10
  benchmark/fragment.html
10
11
  benchmark/helper.rb
@@ -14,17 +15,20 @@ lib/loofah/elements.rb
14
15
  lib/loofah/helpers.rb
15
16
  lib/loofah/html/document.rb
16
17
  lib/loofah/html/document_fragment.rb
18
+ lib/loofah/html5/libxml2_workarounds.rb
19
+ lib/loofah/html5/safelist.rb
17
20
  lib/loofah/html5/scrub.rb
18
- lib/loofah/html5/whitelist.rb
19
21
  lib/loofah/instance_methods.rb
20
22
  lib/loofah/metahelpers.rb
21
23
  lib/loofah/scrubber.rb
22
24
  lib/loofah/scrubbers.rb
23
25
  lib/loofah/xml/document.rb
24
26
  lib/loofah/xml/document_fragment.rb
27
+ test/assets/msword.html
25
28
  test/assets/testdata_sanitizer_tests1.dat
26
29
  test/helper.rb
27
30
  test/html5/test_sanitizer.rb
31
+ test/html5/test_scrub.rb
28
32
  test/integration/test_ad_hoc.rb
29
33
  test/integration/test_helpers.rb
30
34
  test/integration/test_html.rb
data/README.md CHANGED
@@ -1,16 +1,15 @@
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
 
9
9
  |System|Status|
10
10
  |--|--|
11
- | Concourse | [![Concourse CI](https://ci.nokogiri.org/api/v1/teams/nokogiri-core/pipelines/loofah/jobs/ruby-2.5/badge)](https://ci.nokogiri.org/teams/nokogiri-core/pipelines/loofah?groups=master) |
11
+ | Concourse CI | [![Concourse CI](https://ci.nokogiri.org/api/v1/teams/nokogiri-core/pipelines/loofah/jobs/ruby-2.5/badge)](https://ci.nokogiri.org/teams/nokogiri-core/pipelines/loofah?groups=master) |
12
12
  | Code Climate | [![Code Climate](https://codeclimate.com/github/flavorjones/loofah.svg)](https://codeclimate.com/github/flavorjones/loofah) |
13
- | Version Eye | [![Version Eye](https://www.versioneye.com/ruby/loofah/badge.png)](https://www.versioneye.com/ruby/loofah) |
14
13
 
15
14
 
16
15
  ## Description
@@ -20,7 +19,7 @@ documents and fragments. It's built on top of Nokogiri and libxml2, so
20
19
  it's fast and has a nice API.
21
20
 
22
21
  Loofah excels at HTML sanitization (XSS prevention). It includes some
23
- nice HTML sanitizers, which are based on HTML5lib's whitelist, so it
22
+ nice HTML sanitizers, which are based on HTML5lib's safelist, so it
24
23
  most likely won't make your codes less secure. (These statements have
25
24
  not been evaluated by Netexperts.)
26
25
 
@@ -30,7 +29,7 @@ ActiveRecord extensions for sanitization are available in the
30
29
 
31
30
  ## Features
32
31
 
33
- * Easily write custom scrubbers for HTML/XML leveraging the sweetness of Nokogiri (and HTML5lib's whitelists).
32
+ * Easily write custom scrubbers for HTML/XML leveraging the sweetness of Nokogiri (and HTML5lib's safelists).
34
33
  * Common HTML sanitizing tasks are built-in:
35
34
  * _Strip_ unsafe tags, leaving behind only the inner text.
36
35
  * _Prune_ unsafe tags and their subtrees, removing all traces that they ever existed.
@@ -222,7 +221,7 @@ Loofah.xml_document(File.read('plague.xml')).scrub!(bring_out_your_dead)
222
221
  === Built-In HTML Scrubbers
223
222
 
224
223
  Loofah comes with a set of sanitizing scrubbers that use HTML5lib's
225
- whitelist algorithm:
224
+ safelist algorithm:
226
225
 
227
226
  ``` ruby
228
227
  doc.scrub!(:strip) # replaces unknown/unsafe tags with their inner text
@@ -301,23 +300,32 @@ The bug tracker is available here:
301
300
 
302
301
  * https://github.com/flavorjones/loofah/issues
303
302
 
304
- And the mailing list is on librelist:
303
+ And the mailing list is on Google Groups:
305
304
 
306
- * loofah@librelist.com / http://librelist.com
305
+ * Mail: loofah-talk@googlegroups.com
306
+ * Archive: https://groups.google.com/forum/#!forum/loofah-talk
307
307
 
308
308
  And the IRC channel is \#loofah on freenode.
309
309
 
310
310
 
311
311
  ## Security
312
312
 
313
- Some tools may incorrectly report loofah is a potential security
314
- vulnerability. Loofah depends on Nokogiri, and it's possible to use
315
- Nokogiri in a dangerous way (by enabling its DTDLOAD option and
316
- disabling its NONET option). This dangerous Nokogiri configuration,
317
- which is sometimes used by other components, can create an XML
318
- External Entity (XXE) vulnerability if the XML data is not trusted.
319
- However, loofah never enables this dangerous Nokogiri configuration;
320
- loofah never enables DTDLOAD, and it never disables NONET.
313
+ See [`SECURITY.md`](SECURITY.md) for vulnerability reporting details.
314
+
315
+
316
+ ### "Secure by Default"
317
+
318
+ Some tools may incorrectly report Loofah as a potential security
319
+ vulnerability.
320
+
321
+ Loofah depends on Nokogiri, and it's _possible_ to use Nokogiri in a
322
+ dangerous way (by enabling its DTDLOAD option and disabling its NONET
323
+ option). This specifically allows the opportunity for an XML External
324
+ Entity (XXE) vulnerability if the XML data is untrusted.
325
+
326
+ However, Loofah __never enables this Nokogiri configuration__; Loofah
327
+ never enables DTDLOAD, and it never disables NONET, thereby protecting
328
+ you by default from this XXE vulnerability.
321
329
 
322
330
 
323
331
  ## Related Links
@@ -345,7 +353,7 @@ And a big shout-out to Corey Innis for the name, and feedback on the API.
345
353
 
346
354
  ## Thank You
347
355
 
348
- The following people have generously donated via the Pledgie[http://pledgie.com] badge on the {Loofah github page}[https://github.com/flavorjones/loofah]:
356
+ The following people have generously donated via the [Pledgie](http://pledgie.com) badge on the [Loofah github page](https://github.com/flavorjones/loofah):
349
357
 
350
358
  * Bill Harding
351
359
 
data/Rakefile CHANGED
@@ -1,7 +1,6 @@
1
- require 'rubygems'
2
- gem 'hoe', '>= 2.3.0'
3
- require 'hoe'
4
- require 'concourse'
1
+ require "rubygems"
2
+ require "hoe"
3
+ require "concourse"
5
4
 
6
5
  Hoe.plugin :git
7
6
  Hoe.plugin :gemspec
@@ -12,23 +11,23 @@ Hoe.spec "loofah" do
12
11
  developer "Mike Dalessio", "mike.dalessio@gmail.com"
13
12
  developer "Bryan Helmkamp", "bryan@brynary.com"
14
13
 
15
- self.extra_rdoc_files = FileList["*.rdoc"]
16
- self.history_file = "CHANGELOG.md"
17
- self.readme_file = "README.rdoc"
18
- self.license "MIT"
14
+ self.extra_rdoc_files = FileList["*.md"]
15
+ self.history_file = "CHANGELOG.md"
16
+ self.readme_file = "README.md"
17
+ self.license "MIT"
19
18
 
20
- extra_deps << ["nokogiri", ">=1.5.9"]
21
- extra_deps << ["crass", "~> 1.0.2"]
19
+ extra_deps << ["nokogiri", ">=1.5.9"]
20
+ extra_deps << ["crass", "~> 1.0.2"]
22
21
 
23
- extra_dev_deps << ["rake", ">=0.8"]
22
+ extra_dev_deps << ["rake", "~> 12.3"]
24
23
  extra_dev_deps << ["minitest", "~>2.2"]
25
24
  extra_dev_deps << ["rr", "~>1.2.0"]
26
- extra_dev_deps << ["json", ">=0"]
27
- extra_dev_deps << ["hoe-gemspec", ">=0"]
28
- extra_dev_deps << ["hoe-debugging", ">=0"]
29
- extra_dev_deps << ["hoe-bundler", ">=0"]
30
- extra_dev_deps << ["hoe-git", ">=0"]
31
- extra_dev_deps << ["concourse", ">=0.15.0"]
25
+ extra_dev_deps << ["json", "~> 2.2.0"]
26
+ extra_dev_deps << ["hoe-gemspec", "~> 1.0"]
27
+ extra_dev_deps << ["hoe-debugging", "~> 2.0"]
28
+ extra_dev_deps << ["hoe-bundler", "~> 1.5"]
29
+ extra_dev_deps << ["hoe-git", "~> 1.6"]
30
+ extra_dev_deps << ["concourse", ">=0.26.0"]
32
31
  end
33
32
 
34
33
  task :gemspec do
@@ -71,9 +70,12 @@ task :doc_upload_to_rubyforge => :docs do
71
70
  end
72
71
  end
73
72
 
74
- desc "generate whitelists from W3C specifications"
75
- task :generate_whitelists do
76
- load "tasks/generate-whitelists"
73
+ desc "generate safelists from W3C specifications"
74
+ task :generate_safelists do
75
+ load "tasks/generate-safelists"
77
76
  end
78
77
 
79
- Concourse.new("loofah").create_tasks!
78
+ Concourse.new("loofah", fly_target: "ci") do |c|
79
+ c.add_pipeline "loofah", "loofah.yml"
80
+ c.add_pipeline "loofah-pr", "loofah-pr.yml"
81
+ end
data/SECURITY.md ADDED
@@ -0,0 +1,18 @@
1
+ # Security and Vulnerability Reporting
2
+
3
+ The Loofah core contributors take security very seriously and investigate all reported vulnerabilities.
4
+
5
+ If you would like to report a vulnerablity or have a security concern regarding Loofah, please [report it via HackerOne](https://hackerone.com/loofah/reports/new).
6
+
7
+ Your report will be acknowledged within 24 hours, and you'll receive a more detailed response within 72 hours indicating next steps in handling your report.
8
+
9
+ If you have not received a reply to your submission within 48 hours, there are a few steps you can take:
10
+
11
+ * Contact the current security coordinator (Mike Dalessio <mike.dalessio@gmail.com>)
12
+ * Email the Loofah user group at loofah-talk@googlegroups.com (archive at https://groups.google.com/forum/#!forum/loofah-talk)
13
+
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
+
16
+ The information you share with the Loofah core contributors as part of this process will be kept confidential within the team, unless or until we need to share information upstream with our dependent libraries' core teams, at which point we will notify you.
17
+
18
+ If a vulnerability is first reported by you, we will credit you with the discovery in the public disclosure.
@@ -46,8 +46,13 @@ module Loofah
46
46
  @full_sanitizer ||= ::Loofah::Helpers::ActionView::FullSanitizer.new
47
47
  end
48
48
 
49
+ def safe_list_sanitizer
50
+ @safe_list_sanitizer ||= ::Loofah::Helpers::ActionView::SafeListSanitizer.new
51
+ end
52
+
49
53
  def white_list_sanitizer
50
- @white_list_sanitizer ||= ::Loofah::Helpers::ActionView::WhiteListSanitizer.new
54
+ warn "warning: white_list_sanitizer is deprecated, please use safe_list_sanitizer instead."
55
+ safe_list_sanitizer
51
56
  end
52
57
  end
53
58
 
@@ -73,13 +78,13 @@ module Loofah
73
78
  #
74
79
  # To use by default, call this in an application initializer:
75
80
  #
76
- # ActionView::Helpers::SanitizeHelper.white_list_sanitizer = ::Loofah::Helpers::ActionView::WhiteListSanitizer.new
81
+ # ActionView::Helpers::SanitizeHelper.safe_list_sanitizer = ::Loofah::Helpers::ActionView::SafeListSanitizer.new
77
82
  #
78
83
  # Or, to generally opt-in to Loofah's view sanitizers:
79
84
  #
80
85
  # Loofah::Helpers::ActionView.set_as_default_sanitizer
81
86
  #
82
- class WhiteListSanitizer
87
+ class SafeListSanitizer
83
88
  def sanitize html, *args
84
89
  Loofah::Helpers.sanitize html
85
90
  end
@@ -88,6 +93,11 @@ module Loofah
88
93
  Loofah::Helpers.sanitize_css style_string
89
94
  end
90
95
  end
96
+
97
+ WhiteListSanitizer = SafeListSanitizer
98
+ if Object.respond_to?(:deprecate_constant)
99
+ deprecate_constant :WhiteListSanitizer
100
+ end
91
101
  end
92
102
  end
93
103
  end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ require 'set'
3
+
4
+ module Loofah
5
+ #
6
+ # constants related to working around unhelpful libxml2 behavior
7
+ #
8
+ # ಠ_ಠ
9
+ #
10
+ module LibxmlWorkarounds
11
+ #
12
+ # these attributes and qualifying parent tags are determined by the code at:
13
+ #
14
+ # https://git.gnome.org/browse/libxml2/tree/HTMLtree.c?h=v2.9.2#n714
15
+ #
16
+ # see comments about CVE-2018-8048 within the tests for more information
17
+ #
18
+ BROKEN_ESCAPING_ATTRIBUTES = Set.new %w[
19
+ href
20
+ action
21
+ src
22
+ name
23
+ ]
24
+ BROKEN_ESCAPING_ATTRIBUTES_QUALIFYING_TAG = {"name" => "a"}
25
+ end
26
+ end