loofah 2.3.0 → 2.7.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 +4 -4
- data/CHANGELOG.md +95 -40
- data/Gemfile +9 -7
- data/Manifest.txt +0 -16
- data/README.md +3 -9
- data/Rakefile +20 -4
- data/benchmark/benchmark.rb +6 -1
- data/benchmark/helper.rb +15 -15
- data/lib/loofah.rb +21 -2
- data/lib/loofah/elements.rb +74 -73
- data/lib/loofah/helpers.rb +5 -4
- data/lib/loofah/html/document.rb +1 -0
- data/lib/loofah/html/document_fragment.rb +4 -2
- data/lib/loofah/html5/libxml2_workarounds.rb +8 -7
- data/lib/loofah/html5/safelist.rb +12 -5
- data/lib/loofah/html5/scrub.rb +21 -21
- data/lib/loofah/instance_methods.rb +5 -3
- data/lib/loofah/metahelpers.rb +2 -1
- data/lib/loofah/scrubber.rb +8 -7
- data/lib/loofah/scrubbers.rb +11 -10
- data/lib/loofah/xml/document.rb +1 -0
- data/lib/loofah/xml/document_fragment.rb +2 -1
- metadata +45 -34
- data/.gemtest +0 -0
- data/test/assets/msword.html +0 -63
- data/test/assets/testdata_sanitizer_tests1.dat +0 -502
- data/test/helper.rb +0 -18
- data/test/html5/test_sanitizer.rb +0 -401
- data/test/html5/test_scrub.rb +0 -10
- data/test/integration/test_ad_hoc.rb +0 -204
- data/test/integration/test_helpers.rb +0 -43
- data/test/integration/test_html.rb +0 -72
- data/test/integration/test_scrubbers.rb +0 -400
- data/test/integration/test_xml.rb +0 -55
- data/test/unit/test_api.rb +0 -142
- data/test/unit/test_encoding.rb +0 -20
- data/test/unit/test_helpers.rb +0 -62
- data/test/unit/test_scrubber.rb +0 -229
- data/test/unit/test_scrubbers.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce7e800422f2b83325a3c37aeb81c5fcb7f2c6d76d9be1f5228f3d49077643b8
|
4
|
+
data.tar.gz: 6f4a5303926248d42f4e375d59d8d92e60c7fb797762910dd027aa54d8875922
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98570a9ed755a285a42b31c05b8f45413b77119162d190c199f2ea8624f1038cff8ce8532e4339e3747410c9ab8ca645b02f237975643d24b4ad3b447336a35a
|
7
|
+
data.tar.gz: '020485b66a1cb57fe1359bfbeec912631a48b268bbeb754b2ff67fa237cbb840d8ad5e66ec8b64b36d869dcf6866bd3c30191e3596a6481fd9a9258b0f4f8d96'
|
data/CHANGELOG.md
CHANGED
@@ -1,20 +1,75 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## 2.
|
3
|
+
## 2.7.0 / 2020-08-26
|
4
4
|
|
5
5
|
### Features
|
6
6
|
|
7
|
-
*
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
*
|
7
|
+
* 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)!)
|
8
|
+
|
9
|
+
|
10
|
+
### Fixes
|
11
|
+
|
12
|
+
* Don't drop the `!important` rule from some CSS properties. [[#191](https://github.com/flavorjones/loofah/issues/191)] (Thanks, [@b7kich](https://github.com/b7kich)!)
|
13
|
+
|
14
|
+
|
15
|
+
## 2.6.0 / 2020-06-16
|
16
|
+
|
17
|
+
### Features
|
18
|
+
|
19
|
+
* Allow CSS `border-style` keywords. [[#188](https://github.com/flavorjones/loofah/issues/188)] (Thanks, [@tarcisiozf](https://github.com/tarcisiozf)!)
|
20
|
+
|
21
|
+
|
22
|
+
## 2.5.0 / 2020-04-05
|
23
|
+
|
24
|
+
### Features
|
25
|
+
|
26
|
+
* 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)!)
|
27
|
+
|
28
|
+
|
29
|
+
### Fixes
|
30
|
+
|
31
|
+
* Remove comments from `Loofah::HTML::Document`s that exist outside the `html` element. [[#80](https://github.com/flavorjones/loofah/issues/80)]
|
32
|
+
|
33
|
+
|
34
|
+
### Other changes
|
35
|
+
|
36
|
+
* Gem metadata being set [[#181](https://github.com/flavorjones/loofah/issues/181)] (Thanks, [@JuanitoFatas](https://github.com/JuanitoFatas)!)
|
37
|
+
* 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)!)
|
38
|
+
|
39
|
+
|
40
|
+
## 2.4.0 / 2019-11-25
|
41
|
+
|
42
|
+
### Features
|
43
|
+
|
44
|
+
* Allow CSS property `max-width` [[#175](https://github.com/flavorjones/loofah/issues/175)] (Thanks, [@bchaney](https://github.com/bchaney)!)
|
45
|
+
* Allow CSS sizes expressed in `rem` [[#176](https://github.com/flavorjones/loofah/issues/176), [#177](https://github.com/flavorjones/loofah/issues/177)]
|
46
|
+
* Add `frozen_string_literal: true` magic comment to all `lib` files. [[#118](https://github.com/flavorjones/loofah/issues/118)]
|
47
|
+
|
48
|
+
|
49
|
+
## 2.3.1 / 2019-10-22
|
50
|
+
|
51
|
+
### Security
|
52
|
+
|
53
|
+
Address CVE-2019-15587: Unsanitized JavaScript may occur in sanitized output when a crafted SVG element is republished.
|
54
|
+
|
55
|
+
This CVE's public notice is at [#171](https://github.com/flavorjones/loofah/issues/171)
|
56
|
+
|
57
|
+
|
58
|
+
## 2.3.0 / 2019-09-28
|
59
|
+
|
60
|
+
### Features
|
61
|
+
|
62
|
+
* 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)]
|
63
|
+
* Expand set of allowed CSS functions. [related to [#122](https://github.com/flavorjones/loofah/issues/122)]
|
64
|
+
* Allow greater precision in shorthand CSS values. [[#149](https://github.com/flavorjones/loofah/issues/149)] (Thanks, [@danfstucky](https://github.com/danfstucky)!)
|
65
|
+
* Allow CSS property `list-style` [[#162](https://github.com/flavorjones/loofah/issues/162)] (Thanks, [@jaredbeck](https://github.com/jaredbeck)!)
|
66
|
+
* Allow CSS keywords `thick` and `thin` [[#168](https://github.com/flavorjones/loofah/issues/168)] (Thanks, [@georgeclaghorn](https://github.com/georgeclaghorn)!)
|
67
|
+
* Allow HTML property `contenteditable` [[#167](https://github.com/flavorjones/loofah/issues/167)] (Thanks, [@andreynering](https://github.com/andreynering)!)
|
13
68
|
|
14
69
|
|
15
70
|
### Bug fixes
|
16
71
|
|
17
|
-
* CSS hex values are no longer limited to lowercase hex. Previously uppercase hex were scrubbed. [#165] (Thanks, @asok!)
|
72
|
+
* 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)!)
|
18
73
|
|
19
74
|
|
20
75
|
### Deprecations / Name Changes
|
@@ -25,7 +80,7 @@ The following method and constants are hereby deprecated, and will be completely
|
|
25
80
|
* Deprecate `Loofah::Helpers::ActionView::WhiteListSanitizer`, please use `Loofah::Helpers::ActionView::SafeListSanitizer` instead.
|
26
81
|
* Deprecate `Loofah::HTML5::WhiteList`, please use `Loofah::HTML5::SafeList` instead.
|
27
82
|
|
28
|
-
Thanks to @JuanitoFatas for submitting these changes in #164 and for making the language used in Loofah more inclusive.
|
83
|
+
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.
|
29
84
|
|
30
85
|
|
31
86
|
## 2.2.3 / 2018-10-30
|
@@ -34,7 +89,7 @@ Thanks to @JuanitoFatas for submitting these changes in #164 and for making the
|
|
34
89
|
|
35
90
|
Address CVE-2018-16468: Unsanitized JavaScript may occur in sanitized output when a crafted SVG element is republished.
|
36
91
|
|
37
|
-
This CVE's public notice is at https://github.com/flavorjones/loofah/issues/154
|
92
|
+
This CVE's public notice is at [#154](https://github.com/flavorjones/loofah/issues/154)
|
38
93
|
|
39
94
|
|
40
95
|
## Meta / 2018-10-27
|
@@ -61,76 +116,76 @@ attribute scrubbers should they need to address CVE-2018-8048.
|
|
61
116
|
|
62
117
|
Addresses CVE-2018-8048. Loofah allowed non-whitelisted attributes to be present in sanitized output when input with specially-crafted HTML fragments.
|
63
118
|
|
64
|
-
This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
|
119
|
+
This CVE's public notice is at [#144](https://github.com/flavorjones/loofah/issues/144)
|
65
120
|
|
66
121
|
|
67
122
|
## 2.2.0 / 2018-02-11
|
68
123
|
|
69
124
|
### Features:
|
70
125
|
|
71
|
-
* Support HTML5 `<main>` tag. #133 (Thanks, @MothOnMars!)
|
72
|
-
* Recognize HTML5 block elements. #136 (Thanks, @MothOnMars!)
|
73
|
-
* Support SVG `<symbol>` tag. #131 (Thanks, @baopham!)
|
74
|
-
* Support for whitelisting CSS functions, initially just `calc` and `rgb`. #122
|
75
|
-
* Whitelist CSS property `list-style-type`. #68
|
126
|
+
* Support HTML5 `<main>` tag. [#133](https://github.com/flavorjones/loofah/issues/133) (Thanks, [@MothOnMars](https://github.com/MothOnMars)!)
|
127
|
+
* Recognize HTML5 block elements. [#136](https://github.com/flavorjones/loofah/issues/136) (Thanks, [@MothOnMars](https://github.com/MothOnMars)!)
|
128
|
+
* Support SVG `<symbol>` tag. [#131](https://github.com/flavorjones/loofah/issues/131) (Thanks, [@baopham](https://github.com/baopham)!)
|
129
|
+
* 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)!)
|
130
|
+
* 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)!)
|
76
131
|
|
77
132
|
### Bugfixes:
|
78
133
|
|
79
|
-
* Properly handle nested `script` tags. #127.
|
134
|
+
* Properly handle nested `script` tags. [#127](https://github.com/flavorjones/loofah/issues/127).
|
80
135
|
|
81
136
|
|
82
137
|
## 2.1.1 / 2017-09-24
|
83
138
|
|
84
139
|
### Bugfixes:
|
85
140
|
|
86
|
-
* Removed warning for unused variable. #124 (Thanks, @y-yagi!)
|
141
|
+
* Removed warning for unused variable. [#124](https://github.com/flavorjones/loofah/issues/124) (Thanks, [@y-yagi](https://github.com/y-yagi)!)
|
87
142
|
|
88
143
|
|
89
144
|
## 2.1.0 / 2017-09-24
|
90
145
|
|
91
146
|
### Notes:
|
92
147
|
|
93
|
-
* Re-implemented CSS parsing and sanitization using the [crass](https://github.com/rgrove/crass) library. #91
|
148
|
+
* Re-implemented CSS parsing and sanitization using the [crass](https://github.com/rgrove/crass) library. [#91](https://github.com/flavorjones/loofah/issues/91)
|
94
149
|
|
95
150
|
|
96
151
|
### Features:
|
97
152
|
|
98
|
-
* Added :noopener HTML scrubber (Thanks, @tastycode!)
|
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!)
|
153
|
+
* Added :noopener HTML scrubber (Thanks, [@tastycode](https://github.com/tastycode)!)
|
154
|
+
* 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)!)
|
100
155
|
|
101
156
|
|
102
157
|
### Bugfixes:
|
103
158
|
|
104
|
-
* The :unprintable scrubber now scrubs unprintable characters in CDATA nodes (like `<script>`). #124
|
105
|
-
* Allow negative values in CSS properties. Restores functionality that was reverted in v2.0.3. #91
|
159
|
+
* The :unprintable scrubber now scrubs unprintable characters in CDATA nodes (like `<script>`). [#124](https://github.com/flavorjones/loofah/issues/124)
|
160
|
+
* Allow negative values in CSS properties. Restores functionality that was reverted in v2.0.3. [#91](https://github.com/flavorjones/loofah/issues/91)
|
106
161
|
|
107
162
|
|
108
163
|
## 2.0.3 / 2015-08-17
|
109
164
|
|
110
165
|
### Bug fixes:
|
111
166
|
|
112
|
-
* Revert support for negative values in CSS properties due to slow performance. #90 (Related to #85.)
|
167
|
+
* 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).)
|
113
168
|
|
114
169
|
|
115
170
|
## 2.0.2 / 2015-05-05
|
116
171
|
|
117
172
|
### Bug fixes:
|
118
173
|
|
119
|
-
* Fix error with `#to_text` when Loofah::Helpers hadn't been required. #75
|
120
|
-
* Allow multi-word data attributes. #84 (Thanks, @jstorimer!)
|
121
|
-
* Allow negative values in CSS properties. #85 (Thanks, @siddhartham!)
|
174
|
+
* Fix error with `#to_text` when Loofah::Helpers hadn't been required. [#75](https://github.com/flavorjones/loofah/issues/75)
|
175
|
+
* Allow multi-word data attributes. [#84](https://github.com/flavorjones/loofah/issues/84) (Thanks, [@jstorimer](https://github.com/jstorimer)!)
|
176
|
+
* Allow negative values in CSS properties. [#85](https://github.com/flavorjones/loofah/issues/85) (Thanks, [@siddhartham](https://github.com/siddhartham)!)
|
122
177
|
|
123
178
|
|
124
179
|
## 2.0.1 / 2014-08-21
|
125
180
|
|
126
181
|
### Bug fixes:
|
127
182
|
|
128
|
-
* Load RR correctly when running test files directly. (Thanks, @ktdreyer!)
|
183
|
+
* Load RR correctly when running test files directly. (Thanks, [@ktdreyer](https://github.com/ktdreyer)!)
|
129
184
|
|
130
185
|
|
131
186
|
### Notes:
|
132
187
|
|
133
|
-
* Extracted HTML5::Scrub#scrub_css_attribute to accommodate the Rails integration work. (Thanks, @kaspth!)
|
188
|
+
* Extracted HTML5::Scrub#scrub_css_attribute to accommodate the Rails integration work. (Thanks, [@kaspth](https://github.com/kaspth)!)
|
134
189
|
|
135
190
|
|
136
191
|
## 2.0.0 / 2014-05-09
|
@@ -146,19 +201,19 @@ This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
|
|
146
201
|
* tags: `article`, `aside`, `bdi`, `bdo`, `canvas`, `command`, `datalist`, `details`, `figcaption`, `figure`, `footer`, `header`, `mark`, `meter`, `nav`, `output`, `section`, `summary`, `time`
|
147
202
|
* attributes: `data-*` (Thanks, Rafael Franca!)
|
148
203
|
* URI attributes: `poster` and `preload`
|
149
|
-
* Addition of the `:unprintable` scrubber to remove unprintable characters from text nodes. #65 (Thanks, Matt Swanson!)
|
150
|
-
* `Loofah.fragment` accepts an optional encoding argument, compatible with `Nokogiri::HTML::DocumentFragment.parse`. #62 (Thanks, Ben Atkins!)
|
204
|
+
* Addition of the `:unprintable` scrubber to remove unprintable characters from text nodes. [#65](https://github.com/flavorjones/loofah/issues/65) (Thanks, Matt Swanson!)
|
205
|
+
* `Loofah.fragment` accepts an optional encoding argument, compatible with `Nokogiri::HTML::DocumentFragment.parse`. [#62](https://github.com/flavorjones/loofah/issues/62) (Thanks, Ben Atkins!)
|
151
206
|
* HTML5 sanitizers now remove attributes without values. (Thanks, Kasper Timm Hansen!)
|
152
207
|
|
153
208
|
### Bug fixes:
|
154
209
|
|
155
210
|
* HTML5 sanitizers' CSS keyword check now actually works (broken in v2.0). Additional regression tests added. (Thanks, Kasper Timm Hansen!)
|
156
|
-
* HTML5 sanitizers now allow negative arguments to CSS. #64 (Thanks, Jon Calhoun!)
|
211
|
+
* HTML5 sanitizers now allow negative arguments to CSS. [#64](https://github.com/flavorjones/loofah/issues/64) (Thanks, Jon Calhoun!)
|
157
212
|
|
158
213
|
|
159
214
|
## 1.2.1 (2012-04-14)
|
160
215
|
|
161
|
-
* Declaring encoding in html5/scrub.rb. Without this, use of the ruby -KU option would cause havoc. (#32)
|
216
|
+
* 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))
|
162
217
|
|
163
218
|
|
164
219
|
## 1.2.0 (2011-08-08)
|
@@ -176,7 +231,7 @@ This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
|
|
176
231
|
* Additional HTML5lib whitelist elements (from html5lib 1524:80b5efe26230).
|
177
232
|
Up to date with HTML5lib ruby code as of 1723:7ee6a0331856.
|
178
233
|
* Whitelists (which are not part of the public API) are now Sets (were previously Arrays).
|
179
|
-
* Don't explode when encountering UTF-8 URIs. (#25, #29)
|
234
|
+
* Don't explode when encountering UTF-8 URIs. ([#25](https://github.com/flavorjones/loofah/issues/25), [#29](https://github.com/flavorjones/loofah/issues/29))
|
180
235
|
|
181
236
|
|
182
237
|
## 1.0.0 (2010-10-26)
|
@@ -194,7 +249,7 @@ This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
|
|
194
249
|
* New methods Loofah::HTML::Document#to_text and
|
195
250
|
Loofah::HTML::DocumentFragment#to_text do the right thing with
|
196
251
|
whitespace. Note that these methods are significantly slower than
|
197
|
-
#text. GH #12
|
252
|
+
#text. GH [#12](https://github.com/flavorjones/loofah/issues/12)
|
198
253
|
* Loofah::Elements::BLOCK_LEVEL contains a canonical list of HTML4 block-level4 elements.
|
199
254
|
* Loofah::HTML::Document#text and Loofah::HTML::DocumentFragment#text
|
200
255
|
will return unescaped HTML entities by passing :encode_special_chars => false.
|
@@ -208,7 +263,7 @@ This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
|
|
208
263
|
|
209
264
|
### Bug fixes:
|
210
265
|
|
211
|
-
* Loofah::XssFoliate was not properly escaping HTML entities when implicitly scrubbing a string attribute. GH #17
|
266
|
+
* Loofah::XssFoliate was not properly escaping HTML entities when implicitly scrubbing a string attribute. GH [#17](https://github.com/flavorjones/loofah/issues/17)
|
212
267
|
|
213
268
|
|
214
269
|
## 0.4.3 (2010-01-29)
|
@@ -236,7 +291,7 @@ This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
|
|
236
291
|
|
237
292
|
### Bug fixes:
|
238
293
|
|
239
|
-
* Supporting Rails apps that aren't loading ActiveRecord. GH #10
|
294
|
+
* Supporting Rails apps that aren't loading ActiveRecord. GH [#10](https://github.com/flavorjones/loofah/issues/10)
|
240
295
|
|
241
296
|
### Miscellaneous:
|
242
297
|
|
@@ -297,13 +352,13 @@ This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
|
|
297
352
|
### Enhancements:
|
298
353
|
|
299
354
|
* when loaded in a Rails app, automatically extend ActiveRecord::Base
|
300
|
-
with html_fragment and html_document. GH #6 (Thanks Josh Nichols!)
|
355
|
+
with html_fragment and html_document. GH [#6](https://github.com/flavorjones/loofah/issues/6) (Thanks Josh Nichols!)
|
301
356
|
|
302
357
|
### Bugfixes:
|
303
358
|
|
304
359
|
* ActiveRecord scrubbing should generate strings instead of Document or
|
305
|
-
DocumentFragment objects. GH #5
|
306
|
-
* init.rb fixed to support installation as a Rails plugin. GH #6
|
360
|
+
DocumentFragment objects. GH [#5](https://github.com/flavorjones/loofah/issues/5)
|
361
|
+
* init.rb fixed to support installation as a Rails plugin. GH [#6](https://github.com/flavorjones/loofah/issues/6)
|
307
362
|
(Thanks Josh Nichols!)
|
308
363
|
|
309
364
|
|
data/Gemfile
CHANGED
@@ -7,16 +7,18 @@ source "https://rubygems.org/"
|
|
7
7
|
gem "nokogiri", ">=1.5.9"
|
8
8
|
gem "crass", "~>1.0.2"
|
9
9
|
|
10
|
-
gem "rake", "
|
10
|
+
gem "rake", "~>12.3", :group => [:development, :test]
|
11
11
|
gem "minitest", "~>2.2", :group => [:development, :test]
|
12
12
|
gem "rr", "~>1.2.0", :group => [:development, :test]
|
13
|
-
gem "json", "
|
14
|
-
gem "hoe-gemspec", "
|
15
|
-
gem "hoe-debugging", "
|
16
|
-
gem "hoe-bundler", "
|
17
|
-
gem "hoe-git", "
|
13
|
+
gem "json", "~>2.3.0", :group => [:development, :test]
|
14
|
+
gem "hoe-gemspec", "~>1.0", :group => [:development, :test]
|
15
|
+
gem "hoe-debugging", "~>2.0", :group => [:development, :test]
|
16
|
+
gem "hoe-bundler", "~>1.5", :group => [:development, :test]
|
17
|
+
gem "hoe-git", "~>1.6", :group => [:development, :test]
|
18
|
+
gem "hoe-markdown", "~>1.2", :group => [:development, :test]
|
18
19
|
gem "concourse", ">=0.26.0", :group => [:development, :test]
|
20
|
+
gem "rubocop", ">=0.76.0", :group => [:development, :test]
|
19
21
|
gem "rdoc", ">=4.0", "<7", :group => [:development, :test]
|
20
|
-
gem "hoe", "~>3.
|
22
|
+
gem "hoe", "~>3.22", :group => [:development, :test]
|
21
23
|
|
22
24
|
# vim: syntax=ruby
|
data/Manifest.txt
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
.gemtest
|
2
1
|
CHANGELOG.md
|
3
2
|
Gemfile
|
4
3
|
MIT-LICENSE.txt
|
@@ -24,18 +23,3 @@ lib/loofah/scrubber.rb
|
|
24
23
|
lib/loofah/scrubbers.rb
|
25
24
|
lib/loofah/xml/document.rb
|
26
25
|
lib/loofah/xml/document_fragment.rb
|
27
|
-
test/assets/msword.html
|
28
|
-
test/assets/testdata_sanitizer_tests1.dat
|
29
|
-
test/helper.rb
|
30
|
-
test/html5/test_sanitizer.rb
|
31
|
-
test/html5/test_scrub.rb
|
32
|
-
test/integration/test_ad_hoc.rb
|
33
|
-
test/integration/test_helpers.rb
|
34
|
-
test/integration/test_html.rb
|
35
|
-
test/integration/test_scrubbers.rb
|
36
|
-
test/integration/test_xml.rb
|
37
|
-
test/unit/test_api.rb
|
38
|
-
test/unit/test_encoding.rb
|
39
|
-
test/unit/test_helpers.rb
|
40
|
-
test/unit/test_scrubber.rb
|
41
|
-
test/unit/test_scrubbers.rb
|
data/README.md
CHANGED
@@ -14,17 +14,11 @@
|
|
14
14
|
|
15
15
|
## Description
|
16
16
|
|
17
|
-
Loofah is a general library for manipulating and transforming HTML/XML
|
18
|
-
documents and fragments. It's built on top of Nokogiri and libxml2, so
|
19
|
-
it's fast and has a nice API.
|
17
|
+
Loofah is a general library for manipulating and transforming HTML/XML documents and fragments, built on top of Nokogiri.
|
20
18
|
|
21
|
-
Loofah excels at HTML sanitization (XSS prevention). It includes some
|
22
|
-
nice HTML sanitizers, which are based on HTML5lib's safelist, so it
|
23
|
-
most likely won't make your codes less secure. (These statements have
|
24
|
-
not been evaluated by Netexperts.)
|
19
|
+
Loofah excels at HTML sanitization (XSS prevention). It includes some nice HTML sanitizers, which are based on HTML5lib's safelist, so it most likely won't make your codes less secure. (These statements have not been evaluated by Netexperts.)
|
25
20
|
|
26
|
-
ActiveRecord extensions for sanitization are available in the
|
27
|
-
[`loofah-activerecord` gem](https://github.com/flavorjones/loofah-activerecord).
|
21
|
+
ActiveRecord extensions for sanitization are available in the [`loofah-activerecord` gem](https://github.com/flavorjones/loofah-activerecord).
|
28
22
|
|
29
23
|
|
30
24
|
## Features
|
data/Rakefile
CHANGED
@@ -6,15 +6,20 @@ Hoe.plugin :git
|
|
6
6
|
Hoe.plugin :gemspec
|
7
7
|
Hoe.plugin :bundler
|
8
8
|
Hoe.plugin :debugging
|
9
|
+
Hoe.plugin :markdown
|
9
10
|
|
10
11
|
Hoe.spec "loofah" do
|
11
12
|
developer "Mike Dalessio", "mike.dalessio@gmail.com"
|
12
13
|
developer "Bryan Helmkamp", "bryan@brynary.com"
|
13
14
|
|
14
|
-
self.extra_rdoc_files = FileList["*.md"]
|
15
|
-
self.history_file = "CHANGELOG.md"
|
16
|
-
self.readme_file = "README.md"
|
17
15
|
self.license "MIT"
|
16
|
+
self.urls = {
|
17
|
+
"home" => "https://github.com/flavorjones/loofah",
|
18
|
+
"bugs" => "https://github.com/flavorjones/loofah/issues",
|
19
|
+
"doco" => "https://www.rubydoc.info/gems/loofah/",
|
20
|
+
"clog" => "https://github.com/flavorjones/loofah/blob/master/CHANGELOG.md",
|
21
|
+
"code" => "https://github.com/flavorjones/loofah",
|
22
|
+
}
|
18
23
|
|
19
24
|
extra_deps << ["nokogiri", ">=1.5.9"]
|
20
25
|
extra_deps << ["crass", "~> 1.0.2"]
|
@@ -22,12 +27,14 @@ Hoe.spec "loofah" do
|
|
22
27
|
extra_dev_deps << ["rake", "~> 12.3"]
|
23
28
|
extra_dev_deps << ["minitest", "~>2.2"]
|
24
29
|
extra_dev_deps << ["rr", "~>1.2.0"]
|
25
|
-
extra_dev_deps << ["json", "~> 2.
|
30
|
+
extra_dev_deps << ["json", "~> 2.3.0"]
|
26
31
|
extra_dev_deps << ["hoe-gemspec", "~> 1.0"]
|
27
32
|
extra_dev_deps << ["hoe-debugging", "~> 2.0"]
|
28
33
|
extra_dev_deps << ["hoe-bundler", "~> 1.5"]
|
29
34
|
extra_dev_deps << ["hoe-git", "~> 1.6"]
|
35
|
+
extra_dev_deps << ["hoe-markdown", "~> 1.2"]
|
30
36
|
extra_dev_deps << ["concourse", ">=0.26.0"]
|
37
|
+
extra_dev_deps << ["rubocop", ">=0.76.0"]
|
31
38
|
end
|
32
39
|
|
33
40
|
task :gemspec do
|
@@ -75,6 +82,15 @@ task :generate_safelists do
|
|
75
82
|
load "tasks/generate-safelists"
|
76
83
|
end
|
77
84
|
|
85
|
+
task :rubocop => [:rubocop_security, :rubocop_frozen_string_literals]
|
86
|
+
task :rubocop_security do
|
87
|
+
sh "rubocop lib --only Security"
|
88
|
+
end
|
89
|
+
task :rubocop_frozen_string_literals do
|
90
|
+
sh "rubocop lib --auto-correct --only Style/FrozenStringLiteralComment"
|
91
|
+
end
|
92
|
+
Rake::Task[:test].prerequisites << :rubocop
|
93
|
+
|
78
94
|
Concourse.new("loofah", fly_target: "ci") do |c|
|
79
95
|
c.add_pipeline "loofah", "loofah.yml"
|
80
96
|
c.add_pipeline "loofah-pr", "loofah-pr.yml"
|
data/benchmark/benchmark.rb
CHANGED
@@ -23,7 +23,7 @@ def compare_scrub_methods
|
|
23
23
|
end
|
24
24
|
|
25
25
|
module TestSet
|
26
|
-
def test_set
|
26
|
+
def test_set(options = {})
|
27
27
|
scale = options[:rehearse] ? 10 : 1
|
28
28
|
puts self.class.name
|
29
29
|
|
@@ -49,6 +49,7 @@ end
|
|
49
49
|
|
50
50
|
class HeadToHeadRailsSanitize < Measure
|
51
51
|
include TestSet
|
52
|
+
|
52
53
|
def bench(content, ntimes, fragment_p)
|
53
54
|
clear_measure
|
54
55
|
|
@@ -65,6 +66,7 @@ end
|
|
65
66
|
|
66
67
|
class HeadToHeadRailsStripTags < Measure
|
67
68
|
include TestSet
|
69
|
+
|
68
70
|
def bench(content, ntimes, fragment_p)
|
69
71
|
clear_measure
|
70
72
|
|
@@ -81,6 +83,7 @@ end
|
|
81
83
|
|
82
84
|
class HeadToHeadSanitizerSanitize < Measure
|
83
85
|
include TestSet
|
86
|
+
|
84
87
|
def bench(content, ntimes, fragment_p)
|
85
88
|
clear_measure
|
86
89
|
|
@@ -100,6 +103,7 @@ end
|
|
100
103
|
|
101
104
|
class HeadToHeadHtml5LibSanitize < Measure
|
102
105
|
include TestSet
|
106
|
+
|
103
107
|
def bench(content, ntimes, fragment_p)
|
104
108
|
clear_measure
|
105
109
|
|
@@ -120,6 +124,7 @@ end
|
|
120
124
|
|
121
125
|
class HeadToHeadHTMLFilter < Measure
|
122
126
|
include TestSet
|
127
|
+
|
123
128
|
def bench(content, ntimes, fragment_p)
|
124
129
|
clear_measure
|
125
130
|
|