loofah 0.4.2 → 2.25.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.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +604 -0
  3. data/MIT-LICENSE.txt +3 -1
  4. data/README.md +410 -0
  5. data/SECURITY.md +18 -0
  6. data/lib/loofah/concerns.rb +207 -0
  7. data/lib/loofah/elements.rb +98 -0
  8. data/lib/loofah/helpers.rb +91 -4
  9. data/lib/loofah/html4/document.rb +17 -0
  10. data/lib/loofah/html4/document_fragment.rb +15 -0
  11. data/lib/loofah/html5/document.rb +17 -0
  12. data/lib/loofah/html5/document_fragment.rb +15 -0
  13. data/lib/loofah/html5/libxml2_workarounds.rb +28 -0
  14. data/lib/loofah/html5/safelist.rb +1058 -0
  15. data/lib/loofah/html5/scrub.rb +211 -40
  16. data/lib/loofah/metahelpers.rb +18 -0
  17. data/lib/loofah/scrubber.rb +31 -13
  18. data/lib/loofah/scrubbers.rb +262 -31
  19. data/lib/loofah/version.rb +6 -0
  20. data/lib/loofah/xml/document.rb +2 -0
  21. data/lib/loofah/xml/document_fragment.rb +6 -9
  22. data/lib/loofah.rb +131 -52
  23. metadata +79 -158
  24. data/CHANGELOG.rdoc +0 -92
  25. data/DEPRECATED.rdoc +0 -12
  26. data/Manifest.txt +0 -34
  27. data/README.rdoc +0 -330
  28. data/Rakefile +0 -61
  29. data/TODO.rdoc +0 -4
  30. data/benchmark/benchmark.rb +0 -149
  31. data/benchmark/fragment.html +0 -96
  32. data/benchmark/helper.rb +0 -73
  33. data/benchmark/www.slashdot.com.html +0 -2560
  34. data/init.rb +0 -1
  35. data/lib/loofah/active_record.rb +0 -62
  36. data/lib/loofah/html/document.rb +0 -22
  37. data/lib/loofah/html/document_fragment.rb +0 -46
  38. data/lib/loofah/html5/whitelist.rb +0 -174
  39. data/lib/loofah/instance_methods.rb +0 -77
  40. data/lib/loofah/xss_foliate.rb +0 -212
  41. data/test/helper.rb +0 -8
  42. data/test/html5/test_sanitizer.rb +0 -248
  43. data/test/test_active_record.rb +0 -146
  44. data/test/test_ad_hoc.rb +0 -272
  45. data/test/test_api.rb +0 -128
  46. data/test/test_helpers.rb +0 -28
  47. data/test/test_scrubber.rb +0 -227
  48. data/test/test_scrubbers.rb +0 -144
  49. data/test/test_xss_foliate.rb +0 -171
  50. data.tar.gz.sig +0 -0
  51. metadata.gz.sig +0 -2
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6494f909053083504e78578fee2ee3eea7ea3779f56dcc190f55bf2e0944a534
4
+ data.tar.gz: c8eb417d4a46efcffb41256ff928d51bd7503f20356450c27853c9c1b1d06539
5
+ SHA512:
6
+ metadata.gz: 89fafc68ced95a9dfa715e52a0033804e67e1935fbf0a7b4ec74708d6d1b975b1498507d2eb43cbba481562e9817db5f4d80bd797ba8470099ab7754dc0a8ef6
7
+ data.tar.gz: 6ef9cec163006ad1d7c995828cb7036ec8b7923611737c3ee2b1a98f69d2cb973847b8a39eb6b198039e258c0d10644bc5c817946524643b12c4d31e37b4e4e3
data/CHANGELOG.md ADDED
@@ -0,0 +1,604 @@
1
+ # Changelog
2
+
3
+ ## 2.25.0 / 2025-12-15
4
+
5
+ * Extract `Loofah::HTML5::Scrub.allowed_uri?` which operates on a string. Previously this logic was coupled to the parsed tree in `.scrub_uri_attribute`. #300 @flavorjones
6
+ * Tightened up how entities and control characters are handled when detecting allowed URIs. #301 @flavorjones
7
+
8
+
9
+ ## 2.24.1 / 2025-05-12
10
+
11
+ ### Ruby support
12
+
13
+ * Import only what's needed from `cgi` for support for Ruby 3.5 #296 @Earlopain
14
+
15
+
16
+ ## 2.24.0 / 2024-12-24
17
+
18
+ ### Added
19
+
20
+ * Built-in scrubber `:double_breakpoint` which sees `<br><br>` and wraps the surrounding content in `<p>` tags. #279, #284 @josecolella @torihuang
21
+
22
+ ### Improved
23
+
24
+ * Built-in scrubber `:targetblank` now skips `a` tags whose `href` attribute is an anchor link. Previously, all `a` tags were modified to have `target='_blank'`. #291 @fnando
25
+
26
+
27
+ ## 2.23.1 / 2024-10-25
28
+
29
+ ### Added
30
+
31
+ * Allow CSS properties `min-height` and `max-height`. [#288] @lazyatom
32
+
33
+
34
+ ## 2.23.0 / 2024-10-24
35
+
36
+ ### Added
37
+
38
+ * Allow CSS property `min-width`. [#287] @lazyatom
39
+
40
+
41
+ ## 2.22.0 / 2023-11-13
42
+
43
+ ### Added
44
+
45
+ * A `:targetblank` HTML scrubber which ensures all hyperlinks have `target="_blank"`. [#275] @stefannibrasil and @thdaraujo
46
+ * A `:noreferrer` HTML scrubber which ensures all hyperlinks have `rel=noreferrer`, similar to the `:nofollow` and `:noopener` scrubbers. [#277] @wynksaiddestroy
47
+
48
+
49
+ ## 2.21.4 / 2023-10-10
50
+
51
+ ### Fixed
52
+
53
+ * `Loofah::HTML5::Scrub.scrub_css` is more consistent in preserving whitespace (and lack of whitespace) in CSS property values. In particular, `.scrub_css` no longer inserts whitespace between tokens that did not already have whitespace between them. [[#273](https://github.com/flavorjones/loofah/issues/273), fixes [#271](https://github.com/flavorjones/loofah/issues/271)]
54
+
55
+
56
+ ## 2.21.3 / 2023-05-15
57
+
58
+ ### Fixed
59
+
60
+ * Quash "instance variable not initialized" warning in Ruby < 3.0. [[#268](https://github.com/flavorjones/loofah/issues/268)] (Thanks, [@dharamgollapudi](https://github.com/dharamgollapudi)!)
61
+
62
+
63
+ ## 2.21.2 / 2023-05-11
64
+
65
+ ### Dependencies
66
+
67
+ * Update the dependency on Nokogiri to be `>= 1.12.0`. The dependency in 2.21.0 and 2.21.1 was left at `>= 1.5.9` but versions before 1.12 would result in a `NameError` exception. [[#266](https://github.com/flavorjones/loofah/issues/266)]
68
+
69
+
70
+ ## 2.21.1 / 2023-05-10
71
+
72
+ ### Fixed
73
+
74
+ * Don't define `HTML5::Document` and `HTML5::DocumentFragment` when Nokogiri is `< 1.14`. In 2.21.0 these classes were defined whenever `Nokogiri::HTML5` was defined, but Nokogiri v1.12 and v1.13 do not support Loofah subclassing properly.
75
+
76
+
77
+ ## 2.21.0 / 2023-05-10
78
+
79
+ ### HTML5 Support
80
+
81
+ Classes `Loofah::HTML5::Document` and `Loofah::HTML5::DocumentFragment` are introduced, along with helper methods:
82
+
83
+ - `Loofah.html5_document`
84
+ - `Loofah.html5_fragment`
85
+ - `Loofah.scrub_html5_document`
86
+ - `Loofah.scrub_html5_fragment`
87
+
88
+ These classes and methods use Nokogiri's HTML5 parser to ensure modern web standards are used.
89
+
90
+ ⚠ HTML5 functionality is only available with Nokogiri v1.14.0 and higher.
91
+
92
+ ⚠ HTML5 functionality is not available for JRuby. Please see [this upstream Nokogiri issue](https://github.com/sparklemotion/nokogiri/issues/2227) if you're interested in helping implement and support HTML5 support.
93
+
94
+
95
+ ### `Loofah::HTML4` module and namespace
96
+
97
+ `Loofah::HTML` has been renamed to `Loofah::HTML4`, and `Loofah::HTML` is aliased to preserve backwards-compatibility. `Nokogiri::HTML` and `Nokogiri::HTML4` parse methods still use libxml2's (or NekoHTML's) HTML4 parser.
98
+
99
+ Take special note that if you rely on the class name of an object in your code, objects will now report a class of `Loofah::HTML4::Foo` where they previously reported `Loofah::HTML::Foo`. Instead of relying on the string returned by `Object#class`, prefer `Class#===` or `Object#is_a?` or `Object#instance_of?`.
100
+
101
+ Future releases of Nokogiri may deprecate `HTML` classes and methods or otherwise change this behavior, so please start using `HTML4` in place of `HTML`.
102
+
103
+
104
+ ### Official support for JRuby
105
+
106
+ This version introduces official support for JRuby. Previously, the test suite had never been green due to differences in behavior in the underlying HTML parser used by Nokogiri. We've updated the test suite to accommodate those differences, and have added JRuby to the CI suite.
107
+
108
+
109
+ ## 2.20.0 / 2023-04-01
110
+
111
+ ### Features
112
+
113
+ * Allow SVG attributes `color-profile`, `cursor`, `filter`, `marker`, and `mask`. [[#246](https://github.com/flavorjones/loofah/issues/246)]
114
+ * Allow SVG elements `altGlyph`, `cursor`, `feImage`, `pattern`, and `tref`. [[#246](https://github.com/flavorjones/loofah/issues/246)]
115
+ * Allow protocols `fax` and `modem`. [[#255](https://github.com/flavorjones/loofah/issues/255)] (Thanks, [@cjba7](https://github.com/cjba7)!)
116
+
117
+
118
+ ## 2.19.1 / 2022-12-13
119
+
120
+ ### Security
121
+
122
+ * Address CVE-2022-23514, inefficient regular expression complexity. See [GHSA-486f-hjj9-9vhh](https://github.com/flavorjones/loofah/security/advisories/GHSA-486f-hjj9-9vhh) for more information.
123
+ * Address CVE-2022-23515, improper neutralization of data URIs. See [GHSA-228g-948r-83gx](https://github.com/flavorjones/loofah/security/advisories/GHSA-228g-948r-83gx) for more information.
124
+ * Address CVE-2022-23516, uncontrolled recursion. See [GHSA-3x8r-x6xp-q4vm](https://github.com/flavorjones/loofah/security/advisories/GHSA-3x8r-x6xp-q4vm) for more information.
125
+
126
+
127
+ ## 2.19.0 / 2022-09-14
128
+
129
+ ### Features
130
+
131
+ * Allow SVG 1.0 color keyword names in CSS attributes. These colors are part of the [CSS Color Module Level 3](https://www.w3.org/TR/css-color-3/#svg-color) recommendation released 2022-01-18. [[#243](https://github.com/flavorjones/loofah/issues/243)]
132
+
133
+
134
+ ## 2.18.0 / 2022-05-11
135
+
136
+ ### Features
137
+
138
+ * Allow CSS property `aspect-ratio`. [[#236](https://github.com/flavorjones/loofah/issues/236)] (Thanks, [@louim](https://github.com/louim)!)
139
+
140
+
141
+ ## 2.17.0 / 2022-04-28
142
+
143
+ ### Features
144
+
145
+ * Allow ARIA attributes. [[#232](https://github.com/flavorjones/loofah/issues/232), [#233](https://github.com/flavorjones/loofah/issues/233)] (Thanks, [@nick-desteffen](https://github.com/nick-desteffen)!)
146
+
147
+
148
+ ## 2.16.0 / 2022-04-01
149
+
150
+ ### Features
151
+
152
+ * Allow MathML elements `menclose` and `ms`, and MathML attributes `dir`, `href`, `lquote`, `mathsize`, `notation`, and `rquote`. [[#231](https://github.com/flavorjones/loofah/issues/231)] (Thanks, [@nick-desteffen](https://github.com/nick-desteffen)!)
153
+
154
+
155
+ ## 2.15.0 / 2022-03-14
156
+
157
+ ### Features
158
+
159
+ * Expand set of allowed protocols to include `sms:`. [[#228](https://github.com/flavorjones/loofah/issues/228)] (Thanks, [@brendon](https://github.com/brendon)!)
160
+
161
+
162
+ ## 2.14.0 / 2022-02-11
163
+
164
+ ### Features
165
+
166
+ * The `#to_text` method on `Loofah::HTML::{Document,DocumentFragment}` replaces `<br>` line break elements with a newline. [[#225](https://github.com/flavorjones/loofah/issues/225)]
167
+
168
+
169
+ ## 2.13.0 / 2021-12-10
170
+
171
+ ### Bug fixes
172
+
173
+ * Loofah::HTML::DocumentFragment#text no longer serializes top-level comment children. [[#221](https://github.com/flavorjones/loofah/issues/221)]
174
+
175
+
176
+ ## 2.12.0 / 2021-08-11
177
+
178
+ ### Features
179
+
180
+ * Support empty HTML5 data attributes. [[#215](https://github.com/flavorjones/loofah/issues/215)]
181
+
182
+
183
+ ## 2.11.0 / 2021-07-31
184
+
185
+ ### Features
186
+
187
+ * Allow HTML5 element `wbr`.
188
+ * Allow all CSS property values for `border-collapse`. [[#201](https://github.com/flavorjones/loofah/issues/201)]
189
+
190
+
191
+ ### Changes
192
+
193
+ * Deprecating `Loofah::HTML5::SafeList::VOID_ELEMENTS` which is not a canonical list of void HTML4 or HTML5 elements.
194
+ * Removed some elements from `Loofah::HTML5::SafeList::VOID_ELEMENTS` that either are not acceptable elements or aren't considered "void" by libxml2.
195
+
196
+
197
+ ## 2.10.0 / 2021-06-06
198
+
199
+ ### Features
200
+
201
+ * Allow CSS properties `overflow-x` and `overflow-y`. [[#206](https://github.com/flavorjones/loofah/issues/206)] (Thanks, [@sampokuokkanen](https://github.com/sampokuokkanen)!)
202
+
203
+
204
+ ## 2.9.1 / 2021-04-07
205
+
206
+ ### Bug fixes
207
+
208
+ * Fix a regression in v2.9.0 which inappropriately removed CSS properties with quoted string values. [[#202](https://github.com/flavorjones/loofah/issues/202)]
209
+
210
+
211
+ ## 2.9.0 / 2021-01-14
212
+
213
+ ### Features
214
+
215
+ * Handle CSS functions in a CSS shorthand property (like `background`). [[#199](https://github.com/flavorjones/loofah/issues/199), [#200](https://github.com/flavorjones/loofah/issues/200)]
216
+
217
+
218
+ ## 2.8.0 / 2020-11-25
219
+
220
+ ### Features
221
+
222
+ * Allow CSS properties `order`, `flex-direction`, `flex-grow`, `flex-wrap`, `flex-shrink`, `flex-flow`, `flex-basis`, `flex`, `justify-content`, `align-self`, `align-items`, and `align-content`. [[#197](https://github.com/flavorjones/loofah/issues/197)] (Thanks, [@miguelperez](https://github.com/miguelperez)!)
223
+
224
+
225
+ ## 2.7.0 / 2020-08-26
226
+
227
+ ### Features
228
+
229
+ * Allow CSS properties `page-break-before`, `page-break-inside`, and `page-break-after`. [[#190](https://github.com/flavorjones/loofah/issues/190)] (Thanks, [@ahorek](https://github.com/ahorek)!)
230
+
231
+
232
+ ### Fixes
233
+
234
+ * Don't drop the `!important` rule from some CSS properties. [[#191](https://github.com/flavorjones/loofah/issues/191)] (Thanks, [@b7kich](https://github.com/b7kich)!)
235
+
236
+
237
+ ## 2.6.0 / 2020-06-16
238
+
239
+ ### Features
240
+
241
+ * Allow CSS `border-style` keywords. [[#188](https://github.com/flavorjones/loofah/issues/188)] (Thanks, [@tarcisiozf](https://github.com/tarcisiozf)!)
242
+
243
+
244
+ ## 2.5.0 / 2020-04-05
245
+
246
+ ### Features
247
+
248
+ * Allow more CSS length units: "ch", "vw", "vh", "Q", "lh", "vmin", "vmax". [[#178](https://github.com/flavorjones/loofah/issues/178)] (Thanks, [@JuanitoFatas](https://github.com/JuanitoFatas)!)
249
+
250
+
251
+ ### Fixes
252
+
253
+ * Remove comments from `Loofah::HTML::Document`s that exist outside the `html` element. [[#80](https://github.com/flavorjones/loofah/issues/80)]
254
+
255
+
256
+ ### Other changes
257
+
258
+ * Gem metadata being set [[#181](https://github.com/flavorjones/loofah/issues/181)] (Thanks, [@JuanitoFatas](https://github.com/JuanitoFatas)!)
259
+ * Test files removed from gem file [[#180](https://github.com/flavorjones/loofah/issues/180),[#166](https://github.com/flavorjones/loofah/issues/166),[#159](https://github.com/flavorjones/loofah/issues/159)] (Thanks, [@JuanitoFatas](https://github.com/JuanitoFatas) and [@greysteil](https://github.com/greysteil)!)
260
+
261
+
262
+ ## 2.4.0 / 2019-11-25
263
+
264
+ ### Features
265
+
266
+ * Allow CSS property `max-width` [[#175](https://github.com/flavorjones/loofah/issues/175)] (Thanks, [@bchaney](https://github.com/bchaney)!)
267
+ * Allow CSS sizes expressed in `rem` [[#176](https://github.com/flavorjones/loofah/issues/176), [#177](https://github.com/flavorjones/loofah/issues/177)]
268
+ * Add `frozen_string_literal: true` magic comment to all `lib` files. [[#118](https://github.com/flavorjones/loofah/issues/118)]
269
+
270
+
271
+ ## 2.3.1 / 2019-10-22
272
+
273
+ ### Security
274
+
275
+ Address CVE-2019-15587: Unsanitized JavaScript may occur in sanitized output when a crafted SVG element is republished.
276
+
277
+ This CVE's public notice is at [#171](https://github.com/flavorjones/loofah/issues/171)
278
+
279
+
280
+ ## 2.3.0 / 2019-09-28
281
+
282
+ ### Features
283
+
284
+ * Expand set of allowed protocols to include `tel:` and `line:`. [[#104](https://github.com/flavorjones/loofah/issues/104), [#147](https://github.com/flavorjones/loofah/issues/147)]
285
+ * Expand set of allowed CSS functions. [related to [#122](https://github.com/flavorjones/loofah/issues/122)]
286
+ * Allow greater precision in shorthand CSS values. [[#149](https://github.com/flavorjones/loofah/issues/149)] (Thanks, [@danfstucky](https://github.com/danfstucky)!)
287
+ * Allow CSS property `list-style` [[#162](https://github.com/flavorjones/loofah/issues/162)] (Thanks, [@jaredbeck](https://github.com/jaredbeck)!)
288
+ * Allow CSS keywords `thick` and `thin` [[#168](https://github.com/flavorjones/loofah/issues/168)] (Thanks, [@georgeclaghorn](https://github.com/georgeclaghorn)!)
289
+ * Allow HTML property `contenteditable` [[#167](https://github.com/flavorjones/loofah/issues/167)] (Thanks, [@andreynering](https://github.com/andreynering)!)
290
+
291
+
292
+ ### Bug fixes
293
+
294
+ * CSS hex values are no longer limited to lowercase hex. Previously uppercase hex were scrubbed. [[#165](https://github.com/flavorjones/loofah/issues/165)] (Thanks, [@asok](https://github.com/asok)!)
295
+
296
+
297
+ ### Deprecations / Name Changes
298
+
299
+ The following method and constants are hereby deprecated, and will be completely removed in a future release:
300
+
301
+ * Deprecate `Loofah::Helpers::ActionView.white_list_sanitizer`, please use `Loofah::Helpers::ActionView.safe_list_sanitizer` instead.
302
+ * Deprecate `Loofah::Helpers::ActionView::WhiteListSanitizer`, please use `Loofah::Helpers::ActionView::SafeListSanitizer` instead.
303
+ * Deprecate `Loofah::HTML5::WhiteList`, please use `Loofah::HTML5::SafeList` instead.
304
+
305
+ Thanks to [@JuanitoFatas](https://github.com/JuanitoFatas) for submitting these changes in [#164](https://github.com/flavorjones/loofah/issues/164) and for making the language used in Loofah more inclusive.
306
+
307
+
308
+ ## 2.2.3 / 2018-10-30
309
+
310
+ ### Security
311
+
312
+ Address CVE-2018-16468: Unsanitized JavaScript may occur in sanitized output when a crafted SVG element is republished.
313
+
314
+ This CVE's public notice is at [#154](https://github.com/flavorjones/loofah/issues/154)
315
+
316
+
317
+ ## Meta / 2018-10-27
318
+
319
+ The mailing list is now on Google Groups [#146](https://github.com/flavorjones/loofah/issues/146):
320
+
321
+ * Mail: loofah-talk@googlegroups.com
322
+ * Archive: https://groups.google.com/forum/#!forum/loofah-talk
323
+
324
+ This change was made because librelist no longer appears to be maintained.
325
+
326
+
327
+ ## 2.2.2 / 2018-03-22
328
+
329
+ Make public `Loofah::HTML5::Scrub.force_correct_attribute_escaping!`,
330
+ which was previously a private method. This is so that downstream gems
331
+ (like rails-html-sanitizer) can use this logic directly for their own
332
+ attribute scrubbers should they need to address CVE-2018-8048.
333
+
334
+
335
+ ## 2.2.1 / 2018-03-19
336
+
337
+ ### Security
338
+
339
+ Addresses CVE-2018-8048. Loofah allowed non-whitelisted attributes to be present in sanitized output when input with specially-crafted HTML fragments.
340
+
341
+ This CVE's public notice is at [#144](https://github.com/flavorjones/loofah/issues/144)
342
+
343
+
344
+ ## 2.2.0 / 2018-02-11
345
+
346
+ ### Features:
347
+
348
+ * Support HTML5 `<main>` tag. [#133](https://github.com/flavorjones/loofah/issues/133) (Thanks, [@MothOnMars](https://github.com/MothOnMars)!)
349
+ * Recognize HTML5 block elements. [#136](https://github.com/flavorjones/loofah/issues/136) (Thanks, [@MothOnMars](https://github.com/MothOnMars)!)
350
+ * Support SVG `<symbol>` tag. [#131](https://github.com/flavorjones/loofah/issues/131) (Thanks, [@baopham](https://github.com/baopham)!)
351
+ * Support for whitelisting CSS functions, initially just `calc` and `rgb`. [#122](https://github.com/flavorjones/loofah/issues/122)/[#123](https://github.com/flavorjones/loofah/issues/123)/[#129](https://github.com/flavorjones/loofah/issues/129) (Thanks, [@NikoRoberts](https://github.com/NikoRoberts)!)
352
+ * Whitelist CSS property `list-style-type`. [#68](https://github.com/flavorjones/loofah/issues/68)/[#137](https://github.com/flavorjones/loofah/issues/137)/[#142](https://github.com/flavorjones/loofah/issues/142) (Thanks, [@andela-ysanni](https://github.com/andela-ysanni) and [@NikoRoberts](https://github.com/NikoRoberts)!)
353
+
354
+ ### Bugfixes:
355
+
356
+ * Properly handle nested `script` tags. [#127](https://github.com/flavorjones/loofah/issues/127).
357
+
358
+
359
+ ## 2.1.1 / 2017-09-24
360
+
361
+ ### Bugfixes:
362
+
363
+ * Removed warning for unused variable. [#124](https://github.com/flavorjones/loofah/issues/124) (Thanks, [@y-yagi](https://github.com/y-yagi)!)
364
+
365
+
366
+ ## 2.1.0 / 2017-09-24
367
+
368
+ ### Notes:
369
+
370
+ * Re-implemented CSS parsing and sanitization using the [crass](https://github.com/rgrove/crass) library. [#91](https://github.com/flavorjones/loofah/issues/91)
371
+
372
+
373
+ ### Features:
374
+
375
+ * Added :noopener HTML scrubber (Thanks, [@tastycode](https://github.com/tastycode)!)
376
+ * Support `data` URIs with the following media types: text/plain, text/css, image/png, image/gif, image/jpeg, image/svg+xml. [#101](https://github.com/flavorjones/loofah/issues/101), [#120](https://github.com/flavorjones/loofah/issues/120). (Thanks, [@mrpasquini](https://github.com/mrpasquini)!)
377
+
378
+
379
+ ### Bugfixes:
380
+
381
+ * The :unprintable scrubber now scrubs unprintable characters in CDATA nodes (like `<script>`). [#124](https://github.com/flavorjones/loofah/issues/124)
382
+ * Allow negative values in CSS properties. Restores functionality that was reverted in v2.0.3. [#91](https://github.com/flavorjones/loofah/issues/91)
383
+
384
+
385
+ ## 2.0.3 / 2015-08-17
386
+
387
+ ### Bug fixes:
388
+
389
+ * Revert support for negative values in CSS properties due to slow performance. [#90](https://github.com/flavorjones/loofah/issues/90) (Related to [#85](https://github.com/flavorjones/loofah/issues/85).)
390
+
391
+
392
+ ## 2.0.2 / 2015-05-05
393
+
394
+ ### Bug fixes:
395
+
396
+ * Fix error with `#to_text` when Loofah::Helpers hadn't been required. [#75](https://github.com/flavorjones/loofah/issues/75)
397
+ * Allow multi-word data attributes. [#84](https://github.com/flavorjones/loofah/issues/84) (Thanks, [@jstorimer](https://github.com/jstorimer)!)
398
+ * Allow negative values in CSS properties. [#85](https://github.com/flavorjones/loofah/issues/85) (Thanks, [@siddhartham](https://github.com/siddhartham)!)
399
+
400
+
401
+ ## 2.0.1 / 2014-08-21
402
+
403
+ ### Bug fixes:
404
+
405
+ * Load RR correctly when running test files directly. (Thanks, [@ktdreyer](https://github.com/ktdreyer)!)
406
+
407
+
408
+ ### Notes:
409
+
410
+ * Extracted HTML5::Scrub#scrub_css_attribute to accommodate the Rails integration work. (Thanks, [@kaspth](https://github.com/kaspth)!)
411
+
412
+
413
+ ## 2.0.0 / 2014-05-09
414
+
415
+ ### Compatibility notes:
416
+
417
+ * ActionView helpers now must be required explicitly: `require "loofah/helpers"`
418
+ * Support for Ruby 1.8.7 and prior has been dropped
419
+
420
+ ### Enhancements:
421
+
422
+ * HTML5 whitelist allows the following ...
423
+ * tags: `article`, `aside`, `bdi`, `bdo`, `canvas`, `command`, `datalist`, `details`, `figcaption`, `figure`, `footer`, `header`, `mark`, `meter`, `nav`, `output`, `section`, `summary`, `time`
424
+ * attributes: `data-*` (Thanks, Rafael Franca!)
425
+ * URI attributes: `poster` and `preload`
426
+ * Addition of the `:unprintable` scrubber to remove unprintable characters from text nodes. [#65](https://github.com/flavorjones/loofah/issues/65) (Thanks, Matt Swanson!)
427
+ * `Loofah.fragment` accepts an optional encoding argument, compatible with `Nokogiri::HTML::DocumentFragment.parse`. [#62](https://github.com/flavorjones/loofah/issues/62) (Thanks, Ben Atkins!)
428
+ * HTML5 sanitizers now remove attributes without values. (Thanks, Kasper Timm Hansen!)
429
+
430
+ ### Bug fixes:
431
+
432
+ * HTML5 sanitizers' CSS keyword check now actually works (broken in v2.0). Additional regression tests added. (Thanks, Kasper Timm Hansen!)
433
+ * HTML5 sanitizers now allow negative arguments to CSS. [#64](https://github.com/flavorjones/loofah/issues/64) (Thanks, Jon Calhoun!)
434
+
435
+
436
+ ## 1.2.1 (2012-04-14)
437
+
438
+ * Declaring encoding in html5/scrub.rb. Without this, use of the ruby -KU option would cause havoc. ([#32](https://github.com/flavorjones/loofah/issues/32))
439
+
440
+
441
+ ## 1.2.0 (2011-08-08)
442
+
443
+ ### Enhancements:
444
+
445
+ * Loofah::Helpers.sanitize_css is a replacement for Rails's built-in sanitize_css helper.
446
+ * Improving ActionView integration.
447
+
448
+
449
+ ## 1.1.0 (2011-08-08)
450
+
451
+ ### Enhancements:
452
+
453
+ * Additional HTML5lib whitelist elements (from html5lib 1524:80b5efe26230).
454
+ Up to date with HTML5lib ruby code as of 1723:7ee6a0331856.
455
+ * Whitelists (which are not part of the public API) are now Sets (were previously Arrays).
456
+ * Don't explode when encountering UTF-8 URIs. ([#25](https://github.com/flavorjones/loofah/issues/25), [#29](https://github.com/flavorjones/loofah/issues/29))
457
+
458
+
459
+ ## 1.0.0 (2010-10-26)
460
+
461
+ ### Notes:
462
+
463
+ * Moved ActiveRecord functionality into `loofah-activerecord` gem.
464
+ * Removed DEPRECATIONS.rdoc documenting 0.3.0 API changes.
465
+
466
+
467
+ ## 0.4.7 (2010-03-09)
468
+
469
+ ### Enhancements:
470
+
471
+ * New methods Loofah::HTML::Document#to_text and
472
+ Loofah::HTML::DocumentFragment#to_text do the right thing with
473
+ whitespace. Note that these methods are significantly slower than
474
+ #text. GH [#12](https://github.com/flavorjones/loofah/issues/12)
475
+ * Loofah::Elements::BLOCK_LEVEL contains a canonical list of HTML4 block-level4 elements.
476
+ * Loofah::HTML::Document#text and Loofah::HTML::DocumentFragment#text
477
+ will return unescaped HTML entities by passing :encode_special_chars => false.
478
+
479
+
480
+ ## 0.4.4, 0.4.5, 0.4.6 (2010-02-01)
481
+
482
+ ### Enhancements:
483
+
484
+ * Loofah::HTML::Document#text and Loofah::HTML::DocumentFragment#text now escape HTML entities.
485
+
486
+ ### Bug fixes:
487
+
488
+ * Loofah::XssFoliate was not properly escaping HTML entities when implicitly scrubbing a string attribute. GH [#17](https://github.com/flavorjones/loofah/issues/17)
489
+
490
+
491
+ ## 0.4.3 (2010-01-29)
492
+
493
+ ### Enhancements:
494
+
495
+ * All built-in scrubbers are accepted by ActiveRecord::Base.xss_foliate
496
+ * Loofah::XssFoliate.xss_foliate_all_models replaces use of the constant LOOFAH_XSS_FOLIATE_ALL_MODELS
497
+
498
+ ### Miscellaneous:
499
+
500
+ * Modified documentation for bootstrapping XssFoliate in a Rails app,
501
+ since the use of Bundler breaks the previously-documented method. To
502
+ be safe, always use an initializer file.
503
+
504
+
505
+ ## 0.4.2 (2010-01-22)
506
+
507
+ ### Enhancements:
508
+
509
+ * Implemented Node#scrub! for scrubbing subtrees.
510
+ * Implemented NodeSet#scrub! for scrubbing a set of subtrees.
511
+ * Document.text now only serializes <body> contents (ignores <head>)
512
+ * <head>, <html> and <body> added to the HTML5lib whitelist.
513
+
514
+ ### Bug fixes:
515
+
516
+ * Supporting Rails apps that aren't loading ActiveRecord. GH [#10](https://github.com/flavorjones/loofah/issues/10)
517
+
518
+ ### Miscellaneous:
519
+
520
+ * Mailing list is now loofah@librelist.com / http://librelist.com
521
+ * IRC channel is now \#loofah on freenode.
522
+
523
+
524
+ ## 0.4.1 (2009-11-23)
525
+
526
+ ### Bugfix:
527
+
528
+ * Manifest fixed. Whoops.
529
+
530
+
531
+ ## 0.4.0 (2009-11-21)
532
+
533
+ ### Enhancements:
534
+
535
+ * Scrubber class introduced, allowing development of custom scrubbers.
536
+ * Added support for XML documents and fragments.
537
+ * Added :nofollow HTML scrubber (thanks Luke Melia!)
538
+ * Built-in scrubbing methods refactored to use Scrubber.
539
+
540
+
541
+
542
+ ## 0.3.1 (2009-10-12)
543
+
544
+ ### Bug fixes:
545
+
546
+ * Scrubbed Documents properly render html, head and body tags when serialized.
547
+
548
+
549
+ ## 0.3.0 (2009-10-06)
550
+
551
+ ### Enhancements:
552
+
553
+ * New ActiveRecord extension `xss_foliate`, a drop-in replacement for xss_terminate[http://github.com/look/xss_terminate/tree/master].
554
+ * Replacement methods for Rails's helpers, Loofah::Rails.sanitize and Loofah::Rails.strip_tags.
555
+ * Official support (and test coverage) for Rails versions 2.3, 2.2, 2.1, 2.0 and 1.2.
556
+
557
+ ### Deprecations:
558
+
559
+ * The methods strip_tags, whitewash, whitewash_document, sanitize, and
560
+ sanitize_document have been deprecated. See DEPRECATED.rdoc for
561
+ details on the equivalent calls with the post-0.2 API.
562
+
563
+
564
+ ## 0.2.2 (2009-09-30)
565
+
566
+ ### Enhancements:
567
+
568
+ * ActiveRecord extension scrubs fields in a before_validation callback
569
+ (was previously in a before_save)
570
+
571
+
572
+ ## 0.2.1 (2009-09-19)
573
+
574
+ ### Enhancements:
575
+
576
+ * when loaded in a Rails app, automatically extend ActiveRecord::Base
577
+ with html_fragment and html_document. GH [#6](https://github.com/flavorjones/loofah/issues/6) (Thanks Josh Nichols!)
578
+
579
+ ### Bugfixes:
580
+
581
+ * ActiveRecord scrubbing should generate strings instead of Document or
582
+ DocumentFragment objects. GH [#5](https://github.com/flavorjones/loofah/issues/5)
583
+ * init.rb fixed to support installation as a Rails plugin. GH [#6](https://github.com/flavorjones/loofah/issues/6)
584
+ (Thanks Josh Nichols!)
585
+
586
+
587
+ ## 0.2.0 (2009-09-11)
588
+
589
+ * Swank new API.
590
+ * ActiveRecord extension.
591
+ * Uses Nokogiri's Document and DocumentFragment for parsing.
592
+ * Updated html5lib codes and tests to revision 1384:b9d3153d7be7.
593
+ * Deprecated the Dryopteris sanitization methods. Will be removed in 0.3.0.
594
+ * Documentation! Hey!
595
+
596
+
597
+ ## 0.1.2 (2009-04-30)
598
+
599
+ * Added whitewashing -- removal of all attributes and namespaced nodes. You know, for microsofty HTML.
600
+
601
+
602
+ ## 0.1.0 (2009-02-10)
603
+
604
+ * Birthday!
data/MIT-LICENSE.txt CHANGED
@@ -1,6 +1,8 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2009 Mike Dalessio, Bryan Helmkamp
3
+ The MIT License
4
+
5
+ Copyright (c) 2009 -- 2018 by Mike Dalessio, Bryan Helmkamp
4
6
 
5
7
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
8
  of this software and associated documentation files (the "Software"), to deal