loofah 2.5.0 → 2.9.1
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 +87 -47
- data/README.md +9 -6
- data/lib/loofah.rb +13 -15
- data/lib/loofah/html5/safelist.rb +21 -0
- data/lib/loofah/html5/scrub.rb +46 -22
- data/lib/loofah/version.rb +5 -0
- metadata +23 -92
- data/Gemfile +0 -23
- data/Manifest.txt +0 -25
- data/Rakefile +0 -97
- data/benchmark/benchmark.rb +0 -154
- data/benchmark/fragment.html +0 -96
- data/benchmark/helper.rb +0 -73
- data/benchmark/www.slashdot.com.html +0 -2560
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 492fed0592f752787d888878678d74836accb7d07f2f778d9fdd714a9d311f5e
|
4
|
+
data.tar.gz: 94c3bfdf1bbf5d04f062119461bfeafa751131c780c2297bf892af6aab64607b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58ce037d69172bb6d85acdf4faa0281e82e84ee7ef38212f6897971f7a0aeec2e4d151a6c93d8ec0bcb5e6f7522cc1d1d231c5810ce8b4875651777da3ceb3b7
|
7
|
+
data.tar.gz: ab4f6f053fb29ea9415683c3fa81f8ddcde147381314bc5bc87ccf105a97858846028ae7bb21987b3fc56cfa5c9beed769149b3a8cdc282db5c2bca827c5a57b
|
data/CHANGELOG.md
CHANGED
@@ -1,30 +1,70 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 2.9.1 / 2021-04-07
|
4
|
+
|
5
|
+
### Bug fixes
|
6
|
+
|
7
|
+
* Fix a regression in v2.9.0 which inappropriately removed CSS properties with quoted string values. [[#202](https://github.com/flavorjones/loofah/issues/202)]
|
8
|
+
|
9
|
+
|
10
|
+
## 2.9.0 / 2021-01-14
|
11
|
+
|
12
|
+
### Features
|
13
|
+
|
14
|
+
* 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)]
|
15
|
+
|
16
|
+
|
17
|
+
## 2.8.0 / 2020-11-25
|
18
|
+
|
19
|
+
### Features
|
20
|
+
|
21
|
+
* 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)!)
|
22
|
+
|
23
|
+
|
24
|
+
## 2.7.0 / 2020-08-26
|
25
|
+
|
26
|
+
### Features
|
27
|
+
|
28
|
+
* 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)!)
|
29
|
+
|
30
|
+
|
31
|
+
### Fixes
|
32
|
+
|
33
|
+
* Don't drop the `!important` rule from some CSS properties. [[#191](https://github.com/flavorjones/loofah/issues/191)] (Thanks, [@b7kich](https://github.com/b7kich)!)
|
34
|
+
|
35
|
+
|
36
|
+
## 2.6.0 / 2020-06-16
|
37
|
+
|
38
|
+
### Features
|
39
|
+
|
40
|
+
* Allow CSS `border-style` keywords. [[#188](https://github.com/flavorjones/loofah/issues/188)] (Thanks, [@tarcisiozf](https://github.com/tarcisiozf)!)
|
41
|
+
|
42
|
+
|
3
43
|
## 2.5.0 / 2020-04-05
|
4
44
|
|
5
45
|
### Features
|
6
46
|
|
7
|
-
* Allow more CSS length units: "ch", "vw", "vh", "Q", "lh", "vmin", "vmax". [#178] (Thanks, @JuanitoFatas!)
|
47
|
+
* 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)!)
|
8
48
|
|
9
49
|
|
10
50
|
### Fixes
|
11
51
|
|
12
|
-
* Remove comments from `Loofah::HTML::Document`s that exist outside the `html` element. [#80]
|
52
|
+
* Remove comments from `Loofah::HTML::Document`s that exist outside the `html` element. [[#80](https://github.com/flavorjones/loofah/issues/80)]
|
13
53
|
|
14
54
|
|
15
55
|
### Other changes
|
16
56
|
|
17
|
-
* Gem metadata being set [#181] (Thanks, @JuanitoFatas!)
|
18
|
-
* Test files removed from gem file [#180
|
57
|
+
* Gem metadata being set [[#181](https://github.com/flavorjones/loofah/issues/181)] (Thanks, [@JuanitoFatas](https://github.com/JuanitoFatas)!)
|
58
|
+
* 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)!)
|
19
59
|
|
20
60
|
|
21
61
|
## 2.4.0 / 2019-11-25
|
22
62
|
|
23
63
|
### Features
|
24
64
|
|
25
|
-
* Allow CSS property `max-width` [#175] (Thanks, @bchaney!)
|
26
|
-
* Allow CSS sizes expressed in `rem` [#176, #177]
|
27
|
-
* Add `frozen_string_literal: true` magic comment to all `lib` files. [#118]
|
65
|
+
* Allow CSS property `max-width` [[#175](https://github.com/flavorjones/loofah/issues/175)] (Thanks, [@bchaney](https://github.com/bchaney)!)
|
66
|
+
* Allow CSS sizes expressed in `rem` [[#176](https://github.com/flavorjones/loofah/issues/176), [#177](https://github.com/flavorjones/loofah/issues/177)]
|
67
|
+
* Add `frozen_string_literal: true` magic comment to all `lib` files. [[#118](https://github.com/flavorjones/loofah/issues/118)]
|
28
68
|
|
29
69
|
|
30
70
|
## 2.3.1 / 2019-10-22
|
@@ -33,24 +73,24 @@
|
|
33
73
|
|
34
74
|
Address CVE-2019-15587: Unsanitized JavaScript may occur in sanitized output when a crafted SVG element is republished.
|
35
75
|
|
36
|
-
This CVE's public notice is at https://github.com/flavorjones/loofah/issues/171
|
76
|
+
This CVE's public notice is at [#171](https://github.com/flavorjones/loofah/issues/171)
|
37
77
|
|
38
78
|
|
39
79
|
## 2.3.0 / 2019-09-28
|
40
80
|
|
41
81
|
### Features
|
42
82
|
|
43
|
-
* Expand set of allowed protocols to include `tel:` and `line:`. [#104, #147]
|
44
|
-
* Expand set of allowed CSS functions. [related to #122]
|
45
|
-
* Allow greater precision in shorthand CSS values. [#149] (Thanks, @danfstucky!)
|
46
|
-
* Allow CSS property `list-style` [#162] (Thanks, @jaredbeck!)
|
47
|
-
* Allow CSS keywords `thick` and `thin` [#168] (Thanks, @georgeclaghorn!)
|
48
|
-
* Allow HTML property `contenteditable` [#167] (Thanks, @andreynering!)
|
83
|
+
* 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)]
|
84
|
+
* Expand set of allowed CSS functions. [related to [#122](https://github.com/flavorjones/loofah/issues/122)]
|
85
|
+
* Allow greater precision in shorthand CSS values. [[#149](https://github.com/flavorjones/loofah/issues/149)] (Thanks, [@danfstucky](https://github.com/danfstucky)!)
|
86
|
+
* Allow CSS property `list-style` [[#162](https://github.com/flavorjones/loofah/issues/162)] (Thanks, [@jaredbeck](https://github.com/jaredbeck)!)
|
87
|
+
* Allow CSS keywords `thick` and `thin` [[#168](https://github.com/flavorjones/loofah/issues/168)] (Thanks, [@georgeclaghorn](https://github.com/georgeclaghorn)!)
|
88
|
+
* Allow HTML property `contenteditable` [[#167](https://github.com/flavorjones/loofah/issues/167)] (Thanks, [@andreynering](https://github.com/andreynering)!)
|
49
89
|
|
50
90
|
|
51
91
|
### Bug fixes
|
52
92
|
|
53
|
-
* CSS hex values are no longer limited to lowercase hex. Previously uppercase hex were scrubbed. [#165] (Thanks, @asok!)
|
93
|
+
* 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)!)
|
54
94
|
|
55
95
|
|
56
96
|
### Deprecations / Name Changes
|
@@ -61,7 +101,7 @@ The following method and constants are hereby deprecated, and will be completely
|
|
61
101
|
* Deprecate `Loofah::Helpers::ActionView::WhiteListSanitizer`, please use `Loofah::Helpers::ActionView::SafeListSanitizer` instead.
|
62
102
|
* Deprecate `Loofah::HTML5::WhiteList`, please use `Loofah::HTML5::SafeList` instead.
|
63
103
|
|
64
|
-
Thanks to @JuanitoFatas for submitting these changes in #164 and for making the language used in Loofah more inclusive.
|
104
|
+
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.
|
65
105
|
|
66
106
|
|
67
107
|
## 2.2.3 / 2018-10-30
|
@@ -70,7 +110,7 @@ Thanks to @JuanitoFatas for submitting these changes in #164 and for making the
|
|
70
110
|
|
71
111
|
Address CVE-2018-16468: Unsanitized JavaScript may occur in sanitized output when a crafted SVG element is republished.
|
72
112
|
|
73
|
-
This CVE's public notice is at https://github.com/flavorjones/loofah/issues/154
|
113
|
+
This CVE's public notice is at [#154](https://github.com/flavorjones/loofah/issues/154)
|
74
114
|
|
75
115
|
|
76
116
|
## Meta / 2018-10-27
|
@@ -97,76 +137,76 @@ attribute scrubbers should they need to address CVE-2018-8048.
|
|
97
137
|
|
98
138
|
Addresses CVE-2018-8048. Loofah allowed non-whitelisted attributes to be present in sanitized output when input with specially-crafted HTML fragments.
|
99
139
|
|
100
|
-
This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
|
140
|
+
This CVE's public notice is at [#144](https://github.com/flavorjones/loofah/issues/144)
|
101
141
|
|
102
142
|
|
103
143
|
## 2.2.0 / 2018-02-11
|
104
144
|
|
105
145
|
### Features:
|
106
146
|
|
107
|
-
* Support HTML5 `<main>` tag. #133 (Thanks, @MothOnMars!)
|
108
|
-
* Recognize HTML5 block elements. #136 (Thanks, @MothOnMars!)
|
109
|
-
* Support SVG `<symbol>` tag. #131 (Thanks, @baopham!)
|
110
|
-
* Support for whitelisting CSS functions, initially just `calc` and `rgb`. #122
|
111
|
-
* Whitelist CSS property `list-style-type`. #68
|
147
|
+
* Support HTML5 `<main>` tag. [#133](https://github.com/flavorjones/loofah/issues/133) (Thanks, [@MothOnMars](https://github.com/MothOnMars)!)
|
148
|
+
* Recognize HTML5 block elements. [#136](https://github.com/flavorjones/loofah/issues/136) (Thanks, [@MothOnMars](https://github.com/MothOnMars)!)
|
149
|
+
* Support SVG `<symbol>` tag. [#131](https://github.com/flavorjones/loofah/issues/131) (Thanks, [@baopham](https://github.com/baopham)!)
|
150
|
+
* 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)!)
|
151
|
+
* 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)!)
|
112
152
|
|
113
153
|
### Bugfixes:
|
114
154
|
|
115
|
-
* Properly handle nested `script` tags. #127.
|
155
|
+
* Properly handle nested `script` tags. [#127](https://github.com/flavorjones/loofah/issues/127).
|
116
156
|
|
117
157
|
|
118
158
|
## 2.1.1 / 2017-09-24
|
119
159
|
|
120
160
|
### Bugfixes:
|
121
161
|
|
122
|
-
* Removed warning for unused variable. #124 (Thanks, @y-yagi!)
|
162
|
+
* Removed warning for unused variable. [#124](https://github.com/flavorjones/loofah/issues/124) (Thanks, [@y-yagi](https://github.com/y-yagi)!)
|
123
163
|
|
124
164
|
|
125
165
|
## 2.1.0 / 2017-09-24
|
126
166
|
|
127
167
|
### Notes:
|
128
168
|
|
129
|
-
* Re-implemented CSS parsing and sanitization using the [crass](https://github.com/rgrove/crass) library. #91
|
169
|
+
* Re-implemented CSS parsing and sanitization using the [crass](https://github.com/rgrove/crass) library. [#91](https://github.com/flavorjones/loofah/issues/91)
|
130
170
|
|
131
171
|
|
132
172
|
### Features:
|
133
173
|
|
134
|
-
* Added :noopener HTML scrubber (Thanks, @tastycode!)
|
135
|
-
* 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!)
|
174
|
+
* Added :noopener HTML scrubber (Thanks, [@tastycode](https://github.com/tastycode)!)
|
175
|
+
* 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)!)
|
136
176
|
|
137
177
|
|
138
178
|
### Bugfixes:
|
139
179
|
|
140
|
-
* The :unprintable scrubber now scrubs unprintable characters in CDATA nodes (like `<script>`). #124
|
141
|
-
* Allow negative values in CSS properties. Restores functionality that was reverted in v2.0.3. #91
|
180
|
+
* The :unprintable scrubber now scrubs unprintable characters in CDATA nodes (like `<script>`). [#124](https://github.com/flavorjones/loofah/issues/124)
|
181
|
+
* Allow negative values in CSS properties. Restores functionality that was reverted in v2.0.3. [#91](https://github.com/flavorjones/loofah/issues/91)
|
142
182
|
|
143
183
|
|
144
184
|
## 2.0.3 / 2015-08-17
|
145
185
|
|
146
186
|
### Bug fixes:
|
147
187
|
|
148
|
-
* Revert support for negative values in CSS properties due to slow performance. #90 (Related to #85.)
|
188
|
+
* 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).)
|
149
189
|
|
150
190
|
|
151
191
|
## 2.0.2 / 2015-05-05
|
152
192
|
|
153
193
|
### Bug fixes:
|
154
194
|
|
155
|
-
* Fix error with `#to_text` when Loofah::Helpers hadn't been required. #75
|
156
|
-
* Allow multi-word data attributes. #84 (Thanks, @jstorimer!)
|
157
|
-
* Allow negative values in CSS properties. #85 (Thanks, @siddhartham!)
|
195
|
+
* Fix error with `#to_text` when Loofah::Helpers hadn't been required. [#75](https://github.com/flavorjones/loofah/issues/75)
|
196
|
+
* Allow multi-word data attributes. [#84](https://github.com/flavorjones/loofah/issues/84) (Thanks, [@jstorimer](https://github.com/jstorimer)!)
|
197
|
+
* Allow negative values in CSS properties. [#85](https://github.com/flavorjones/loofah/issues/85) (Thanks, [@siddhartham](https://github.com/siddhartham)!)
|
158
198
|
|
159
199
|
|
160
200
|
## 2.0.1 / 2014-08-21
|
161
201
|
|
162
202
|
### Bug fixes:
|
163
203
|
|
164
|
-
* Load RR correctly when running test files directly. (Thanks, @ktdreyer!)
|
204
|
+
* Load RR correctly when running test files directly. (Thanks, [@ktdreyer](https://github.com/ktdreyer)!)
|
165
205
|
|
166
206
|
|
167
207
|
### Notes:
|
168
208
|
|
169
|
-
* Extracted HTML5::Scrub#scrub_css_attribute to accommodate the Rails integration work. (Thanks, @kaspth!)
|
209
|
+
* Extracted HTML5::Scrub#scrub_css_attribute to accommodate the Rails integration work. (Thanks, [@kaspth](https://github.com/kaspth)!)
|
170
210
|
|
171
211
|
|
172
212
|
## 2.0.0 / 2014-05-09
|
@@ -182,19 +222,19 @@ This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
|
|
182
222
|
* tags: `article`, `aside`, `bdi`, `bdo`, `canvas`, `command`, `datalist`, `details`, `figcaption`, `figure`, `footer`, `header`, `mark`, `meter`, `nav`, `output`, `section`, `summary`, `time`
|
183
223
|
* attributes: `data-*` (Thanks, Rafael Franca!)
|
184
224
|
* URI attributes: `poster` and `preload`
|
185
|
-
* Addition of the `:unprintable` scrubber to remove unprintable characters from text nodes. #65 (Thanks, Matt Swanson!)
|
186
|
-
* `Loofah.fragment` accepts an optional encoding argument, compatible with `Nokogiri::HTML::DocumentFragment.parse`. #62 (Thanks, Ben Atkins!)
|
225
|
+
* Addition of the `:unprintable` scrubber to remove unprintable characters from text nodes. [#65](https://github.com/flavorjones/loofah/issues/65) (Thanks, Matt Swanson!)
|
226
|
+
* `Loofah.fragment` accepts an optional encoding argument, compatible with `Nokogiri::HTML::DocumentFragment.parse`. [#62](https://github.com/flavorjones/loofah/issues/62) (Thanks, Ben Atkins!)
|
187
227
|
* HTML5 sanitizers now remove attributes without values. (Thanks, Kasper Timm Hansen!)
|
188
228
|
|
189
229
|
### Bug fixes:
|
190
230
|
|
191
231
|
* HTML5 sanitizers' CSS keyword check now actually works (broken in v2.0). Additional regression tests added. (Thanks, Kasper Timm Hansen!)
|
192
|
-
* HTML5 sanitizers now allow negative arguments to CSS. #64 (Thanks, Jon Calhoun!)
|
232
|
+
* HTML5 sanitizers now allow negative arguments to CSS. [#64](https://github.com/flavorjones/loofah/issues/64) (Thanks, Jon Calhoun!)
|
193
233
|
|
194
234
|
|
195
235
|
## 1.2.1 (2012-04-14)
|
196
236
|
|
197
|
-
* Declaring encoding in html5/scrub.rb. Without this, use of the ruby -KU option would cause havoc. (#32)
|
237
|
+
* 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))
|
198
238
|
|
199
239
|
|
200
240
|
## 1.2.0 (2011-08-08)
|
@@ -212,7 +252,7 @@ This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
|
|
212
252
|
* Additional HTML5lib whitelist elements (from html5lib 1524:80b5efe26230).
|
213
253
|
Up to date with HTML5lib ruby code as of 1723:7ee6a0331856.
|
214
254
|
* Whitelists (which are not part of the public API) are now Sets (were previously Arrays).
|
215
|
-
* Don't explode when encountering UTF-8 URIs. (#25, #29)
|
255
|
+
* Don't explode when encountering UTF-8 URIs. ([#25](https://github.com/flavorjones/loofah/issues/25), [#29](https://github.com/flavorjones/loofah/issues/29))
|
216
256
|
|
217
257
|
|
218
258
|
## 1.0.0 (2010-10-26)
|
@@ -230,7 +270,7 @@ This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
|
|
230
270
|
* New methods Loofah::HTML::Document#to_text and
|
231
271
|
Loofah::HTML::DocumentFragment#to_text do the right thing with
|
232
272
|
whitespace. Note that these methods are significantly slower than
|
233
|
-
#text. GH #12
|
273
|
+
#text. GH [#12](https://github.com/flavorjones/loofah/issues/12)
|
234
274
|
* Loofah::Elements::BLOCK_LEVEL contains a canonical list of HTML4 block-level4 elements.
|
235
275
|
* Loofah::HTML::Document#text and Loofah::HTML::DocumentFragment#text
|
236
276
|
will return unescaped HTML entities by passing :encode_special_chars => false.
|
@@ -244,7 +284,7 @@ This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
|
|
244
284
|
|
245
285
|
### Bug fixes:
|
246
286
|
|
247
|
-
* Loofah::XssFoliate was not properly escaping HTML entities when implicitly scrubbing a string attribute. GH #17
|
287
|
+
* Loofah::XssFoliate was not properly escaping HTML entities when implicitly scrubbing a string attribute. GH [#17](https://github.com/flavorjones/loofah/issues/17)
|
248
288
|
|
249
289
|
|
250
290
|
## 0.4.3 (2010-01-29)
|
@@ -272,7 +312,7 @@ This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
|
|
272
312
|
|
273
313
|
### Bug fixes:
|
274
314
|
|
275
|
-
* Supporting Rails apps that aren't loading ActiveRecord. GH #10
|
315
|
+
* Supporting Rails apps that aren't loading ActiveRecord. GH [#10](https://github.com/flavorjones/loofah/issues/10)
|
276
316
|
|
277
317
|
### Miscellaneous:
|
278
318
|
|
@@ -333,13 +373,13 @@ This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
|
|
333
373
|
### Enhancements:
|
334
374
|
|
335
375
|
* when loaded in a Rails app, automatically extend ActiveRecord::Base
|
336
|
-
with html_fragment and html_document. GH #6 (Thanks Josh Nichols!)
|
376
|
+
with html_fragment and html_document. GH [#6](https://github.com/flavorjones/loofah/issues/6) (Thanks Josh Nichols!)
|
337
377
|
|
338
378
|
### Bugfixes:
|
339
379
|
|
340
380
|
* ActiveRecord scrubbing should generate strings instead of Document or
|
341
|
-
DocumentFragment objects. GH #5
|
342
|
-
* init.rb fixed to support installation as a Rails plugin. GH #6
|
381
|
+
DocumentFragment objects. GH [#5](https://github.com/flavorjones/loofah/issues/5)
|
382
|
+
* init.rb fixed to support installation as a Rails plugin. GH [#6](https://github.com/flavorjones/loofah/issues/6)
|
343
383
|
(Thanks Josh Nichols!)
|
344
384
|
|
345
385
|
|
data/README.md
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
# Loofah
|
2
2
|
|
3
3
|
* https://github.com/flavorjones/loofah
|
4
|
-
* Docs: http://rubydoc.info/github/flavorjones/loofah/
|
4
|
+
* Docs: http://rubydoc.info/github/flavorjones/loofah/main/frames
|
5
5
|
* Mailing list: [loofah-talk@googlegroups.com](https://groups.google.com/forum/#!forum/loofah-talk)
|
6
6
|
|
7
7
|
## Status
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
| Code Climate | [![Code Climate](https://codeclimate.com/github/flavorjones/loofah.svg)](https://codeclimate.com/github/flavorjones/loofah) |
|
9
|
+
[![Concourse CI](https://ci.nokogiri.org/api/v1/teams/nokogiri-core/pipelines/loofah/jobs/ruby-3.0/badge)](https://ci.nokogiri.org/teams/nokogiri-core/pipelines/loofah)
|
10
|
+
[![Code Climate](https://codeclimate.com/github/flavorjones/loofah.svg)](https://codeclimate.com/github/flavorjones/loofah)
|
11
|
+
[![Tidelift dependencies](https://tidelift.com/badges/package/rubygems/loofah)](https://tidelift.com/subscription/pkg/rubygems-loofah?utm_source=rubygems-loofah&utm_medium=referral&utm_campaign=readme)
|
13
12
|
|
14
13
|
|
15
14
|
## Description
|
@@ -212,7 +211,7 @@ end
|
|
212
211
|
Loofah.xml_document(File.read('plague.xml')).scrub!(bring_out_your_dead)
|
213
212
|
```
|
214
213
|
|
215
|
-
|
214
|
+
### Built-In HTML Scrubbers
|
216
215
|
|
217
216
|
Loofah comes with a set of sanitizing scrubbers that use HTML5lib's
|
218
217
|
safelist algorithm:
|
@@ -301,6 +300,10 @@ And the mailing list is on Google Groups:
|
|
301
300
|
|
302
301
|
And the IRC channel is \#loofah on freenode.
|
303
302
|
|
303
|
+
Consider subscribing to [Tidelift][tidelift] which provides license assurances and timely security notifications for your open source dependencies, including Loofah. [Tidelift][tidelift] subscriptions also help the Loofah maintainers fund our [automated testing](https://ci.nokogiri.org) which in turn allows us to ship releases, bugfixes, and security updates more often.
|
304
|
+
|
305
|
+
[tidelift]: https://tidelift.com/subscription/pkg/rubygems-loofah?utm_source=undefined&utm_medium=referral&utm_campaign=enterprise
|
306
|
+
|
304
307
|
|
305
308
|
## Security
|
306
309
|
|
data/lib/loofah.rb
CHANGED
@@ -3,21 +3,22 @@ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.i
|
|
3
3
|
|
4
4
|
require "nokogiri"
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
require_relative "loofah/version"
|
7
|
+
require_relative "loofah/metahelpers"
|
8
|
+
require_relative "loofah/elements"
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
require_relative "loofah/html5/safelist"
|
11
|
+
require_relative "loofah/html5/libxml2_workarounds"
|
12
|
+
require_relative "loofah/html5/scrub"
|
12
13
|
|
13
|
-
|
14
|
-
|
14
|
+
require_relative "loofah/scrubber"
|
15
|
+
require_relative "loofah/scrubbers"
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
require_relative "loofah/instance_methods"
|
18
|
+
require_relative "loofah/xml/document"
|
19
|
+
require_relative "loofah/xml/document_fragment"
|
20
|
+
require_relative "loofah/html/document"
|
21
|
+
require_relative "loofah/html/document_fragment"
|
21
22
|
|
22
23
|
# == Strings and IO Objects as Input
|
23
24
|
#
|
@@ -28,9 +29,6 @@ require "loofah/html/document_fragment"
|
|
28
29
|
# quantities of docs.
|
29
30
|
#
|
30
31
|
module Loofah
|
31
|
-
# The version of Loofah you are using
|
32
|
-
VERSION = "2.5.0"
|
33
|
-
|
34
32
|
class << self
|
35
33
|
# Shortcut for Loofah::HTML::Document.parse
|
36
34
|
# This method accepts the same parameters as Nokogiri::HTML::Document.parse
|
@@ -549,6 +549,9 @@ module Loofah
|
|
549
549
|
|
550
550
|
ACCEPTABLE_CSS_PROPERTIES = Set.new([
|
551
551
|
"azimuth",
|
552
|
+
"align-content",
|
553
|
+
"align-items",
|
554
|
+
"align-self",
|
552
555
|
"background-color",
|
553
556
|
"border-bottom-color",
|
554
557
|
"border-collapse",
|
@@ -562,6 +565,13 @@ module Loofah
|
|
562
565
|
"direction",
|
563
566
|
"display",
|
564
567
|
"elevation",
|
568
|
+
"flex",
|
569
|
+
"flex-basis",
|
570
|
+
"flex-direction",
|
571
|
+
"flex-flow",
|
572
|
+
"flex-grow",
|
573
|
+
"flex-shrink",
|
574
|
+
"flex-wrap",
|
565
575
|
"float",
|
566
576
|
"font",
|
567
577
|
"font-family",
|
@@ -570,12 +580,17 @@ module Loofah
|
|
570
580
|
"font-variant",
|
571
581
|
"font-weight",
|
572
582
|
"height",
|
583
|
+
"justify-content",
|
573
584
|
"letter-spacing",
|
574
585
|
"line-height",
|
575
586
|
"list-style",
|
576
587
|
"list-style-type",
|
577
588
|
"max-width",
|
589
|
+
"order",
|
578
590
|
"overflow",
|
591
|
+
"page-break-after",
|
592
|
+
"page-break-before",
|
593
|
+
"page-break-inside",
|
579
594
|
"pause",
|
580
595
|
"pause-after",
|
581
596
|
"pause-before",
|
@@ -614,9 +629,13 @@ module Loofah
|
|
614
629
|
"collapse",
|
615
630
|
"dashed",
|
616
631
|
"dotted",
|
632
|
+
"double",
|
617
633
|
"fuchsia",
|
618
634
|
"gray",
|
619
635
|
"green",
|
636
|
+
"groove",
|
637
|
+
"hidden",
|
638
|
+
"inset",
|
620
639
|
"italic",
|
621
640
|
"left",
|
622
641
|
"lime",
|
@@ -627,9 +646,11 @@ module Loofah
|
|
627
646
|
"normal",
|
628
647
|
"nowrap",
|
629
648
|
"olive",
|
649
|
+
"outset",
|
630
650
|
"pointer",
|
631
651
|
"purple",
|
632
652
|
"red",
|
653
|
+
"ridge",
|
633
654
|
"right",
|
634
655
|
"silver",
|
635
656
|
"solid",
|