loofah 2.2.3 → 2.6.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
2
  SHA256:
3
- metadata.gz: c22c1a749ff878b96f0c4a53e789834fa8072775c5abdccb68c388d6218b1bce
4
- data.tar.gz: e8d00e6ff5d623b3f3d03ce83ee780a88e92138fcb71efff28194f8a7d87e5fc
3
+ metadata.gz: '0378734abbcf1f374d8d501038180ff4d9492e4282ffe4d6134322dd213fc80b'
4
+ data.tar.gz: 54955254f4179bf55adfc5bdaf3464c8a8f921f6e8e7fc92d9d2588b4fea02b1
5
5
  SHA512:
6
- metadata.gz: 0d5a0160010d61a51dad8e31bc644e03454311b99b1d71c6eaea5458cfaaa228671b82db52cf2369b42c48b636b912ca0d812191ac886a5c1499c44fc5221239
7
- data.tar.gz: ac479e283ef08b0df14938ec577a3aa4008d07ba3288232541928794cd0b9fe2512da88ac7fd2d123666dcad67d09c1a07307442610f61adbfd65f143ae339b5
6
+ metadata.gz: e80d9e87682cbfd18b6f86a10f9928c3b94fb7f123792d8284344cf65a878a1ee8258b408dac8df87791ca5beda99858dfbac6515334d87bc2d98b45cdf17802
7
+ data.tar.gz: da7fd4181e8f829837f0d1458e856b8ace6ed94fa13cdc227bc9432baaff0ec514f894b04b9d00157c6edddcff6a714284bc42a1c878a2ddb90d08b68931dba9
@@ -1,12 +1,83 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.6.0 / 2020-06-16
4
+
5
+ ### Features
6
+
7
+ * Allow CSS `border-style` keywords. [[#188](https://github.com/flavorjones/loofah/issues/188)] (Thanks, [@tarcisiozf](https://github.com/tarcisiozf)!)
8
+
9
+
10
+ ## 2.5.0 / 2020-04-05
11
+
12
+ ### Features
13
+
14
+ * 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)!)
15
+
16
+
17
+ ### Fixes
18
+
19
+ * Remove comments from `Loofah::HTML::Document`s that exist outside the `html` element. [[#80](https://github.com/flavorjones/loofah/issues/80)]
20
+
21
+
22
+ ### Other changes
23
+
24
+ * Gem metadata being set [[#181](https://github.com/flavorjones/loofah/issues/181)] (Thanks, [@JuanitoFatas](https://github.com/JuanitoFatas)!)
25
+ * 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)!)
26
+
27
+
28
+ ## 2.4.0 / 2019-11-25
29
+
30
+ ### Features
31
+
32
+ * Allow CSS property `max-width` [[#175](https://github.com/flavorjones/loofah/issues/175)] (Thanks, [@bchaney](https://github.com/bchaney)!)
33
+ * Allow CSS sizes expressed in `rem` [[#176](https://github.com/flavorjones/loofah/issues/176), [#177](https://github.com/flavorjones/loofah/issues/177)]
34
+ * Add `frozen_string_literal: true` magic comment to all `lib` files. [[#118](https://github.com/flavorjones/loofah/issues/118)]
35
+
36
+
37
+ ## 2.3.1 / 2019-10-22
38
+
39
+ ### Security
40
+
41
+ Address CVE-2019-15587: Unsanitized JavaScript may occur in sanitized output when a crafted SVG element is republished.
42
+
43
+ This CVE's public notice is at [#171](https://github.com/flavorjones/loofah/issues/171)
44
+
45
+
46
+ ## 2.3.0 / 2019-09-28
47
+
48
+ ### Features
49
+
50
+ * 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)]
51
+ * Expand set of allowed CSS functions. [related to [#122](https://github.com/flavorjones/loofah/issues/122)]
52
+ * Allow greater precision in shorthand CSS values. [[#149](https://github.com/flavorjones/loofah/issues/149)] (Thanks, [@danfstucky](https://github.com/danfstucky)!)
53
+ * Allow CSS property `list-style` [[#162](https://github.com/flavorjones/loofah/issues/162)] (Thanks, [@jaredbeck](https://github.com/jaredbeck)!)
54
+ * Allow CSS keywords `thick` and `thin` [[#168](https://github.com/flavorjones/loofah/issues/168)] (Thanks, [@georgeclaghorn](https://github.com/georgeclaghorn)!)
55
+ * Allow HTML property `contenteditable` [[#167](https://github.com/flavorjones/loofah/issues/167)] (Thanks, [@andreynering](https://github.com/andreynering)!)
56
+
57
+
58
+ ### Bug fixes
59
+
60
+ * 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)!)
61
+
62
+
63
+ ### Deprecations / Name Changes
64
+
65
+ The following method and constants are hereby deprecated, and will be completely removed in a future release:
66
+
67
+ * Deprecate `Loofah::Helpers::ActionView.white_list_sanitizer`, please use `Loofah::Helpers::ActionView.safe_list_sanitizer` instead.
68
+ * Deprecate `Loofah::Helpers::ActionView::WhiteListSanitizer`, please use `Loofah::Helpers::ActionView::SafeListSanitizer` instead.
69
+ * Deprecate `Loofah::HTML5::WhiteList`, please use `Loofah::HTML5::SafeList` instead.
70
+
71
+ 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.
72
+
73
+
3
74
  ## 2.2.3 / 2018-10-30
4
75
 
5
76
  ### Security
6
77
 
7
78
  Address CVE-2018-16468: Unsanitized JavaScript may occur in sanitized output when a crafted SVG element is republished.
8
79
 
9
- This CVE's public notice is at https://github.com/flavorjones/loofah/issues/154
80
+ This CVE's public notice is at [#154](https://github.com/flavorjones/loofah/issues/154)
10
81
 
11
82
 
12
83
  ## Meta / 2018-10-27
@@ -33,76 +104,76 @@ attribute scrubbers should they need to address CVE-2018-8048.
33
104
 
34
105
  Addresses CVE-2018-8048. Loofah allowed non-whitelisted attributes to be present in sanitized output when input with specially-crafted HTML fragments.
35
106
 
36
- This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
107
+ This CVE's public notice is at [#144](https://github.com/flavorjones/loofah/issues/144)
37
108
 
38
109
 
39
110
  ## 2.2.0 / 2018-02-11
40
111
 
41
112
  ### Features:
42
113
 
43
- * Support HTML5 `<main>` tag. #133 (Thanks, @MothOnMars!)
44
- * Recognize HTML5 block elements. #136 (Thanks, @MothOnMars!)
45
- * Support SVG `<symbol>` tag. #131 (Thanks, @baopham!)
46
- * Support for whitelisting CSS functions, initially just `calc` and `rgb`. #122/#123/#129 (Thanks, @NikoRoberts!)
47
- * Whitelist CSS property `list-style-type`. #68/#137/#142 (Thanks, @andela-ysanni and @NikoRoberts!)
114
+ * Support HTML5 `<main>` tag. [#133](https://github.com/flavorjones/loofah/issues/133) (Thanks, [@MothOnMars](https://github.com/MothOnMars)!)
115
+ * Recognize HTML5 block elements. [#136](https://github.com/flavorjones/loofah/issues/136) (Thanks, [@MothOnMars](https://github.com/MothOnMars)!)
116
+ * Support SVG `<symbol>` tag. [#131](https://github.com/flavorjones/loofah/issues/131) (Thanks, [@baopham](https://github.com/baopham)!)
117
+ * 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)!)
118
+ * 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)!)
48
119
 
49
120
  ### Bugfixes:
50
121
 
51
- * Properly handle nested `script` tags. #127.
122
+ * Properly handle nested `script` tags. [#127](https://github.com/flavorjones/loofah/issues/127).
52
123
 
53
124
 
54
125
  ## 2.1.1 / 2017-09-24
55
126
 
56
127
  ### Bugfixes:
57
128
 
58
- * Removed warning for unused variable. #124 (Thanks, @y-yagi!)
129
+ * Removed warning for unused variable. [#124](https://github.com/flavorjones/loofah/issues/124) (Thanks, [@y-yagi](https://github.com/y-yagi)!)
59
130
 
60
131
 
61
132
  ## 2.1.0 / 2017-09-24
62
133
 
63
134
  ### Notes:
64
135
 
65
- * Re-implemented CSS parsing and sanitization using the [crass](https://github.com/rgrove/crass) library. #91
136
+ * Re-implemented CSS parsing and sanitization using the [crass](https://github.com/rgrove/crass) library. [#91](https://github.com/flavorjones/loofah/issues/91)
66
137
 
67
138
 
68
139
  ### Features:
69
140
 
70
- * Added :noopener HTML scrubber (Thanks, @tastycode!)
71
- * Support `data` URIs with the following media types: text/plain, text/css, image/png, image/gif, image/jpeg, image/svg+xml. #101, #120. (Thanks, @mrpasquini!)
141
+ * Added :noopener HTML scrubber (Thanks, [@tastycode](https://github.com/tastycode)!)
142
+ * 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)!)
72
143
 
73
144
 
74
145
  ### Bugfixes:
75
146
 
76
- * The :unprintable scrubber now scrubs unprintable characters in CDATA nodes (like `<script>`). #124
77
- * Allow negative values in CSS properties. Restores functionality that was reverted in v2.0.3. #91
147
+ * The :unprintable scrubber now scrubs unprintable characters in CDATA nodes (like `<script>`). [#124](https://github.com/flavorjones/loofah/issues/124)
148
+ * Allow negative values in CSS properties. Restores functionality that was reverted in v2.0.3. [#91](https://github.com/flavorjones/loofah/issues/91)
78
149
 
79
150
 
80
151
  ## 2.0.3 / 2015-08-17
81
152
 
82
153
  ### Bug fixes:
83
154
 
84
- * Revert support for negative values in CSS properties due to slow performance. #90 (Related to #85.)
155
+ * 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).)
85
156
 
86
157
 
87
158
  ## 2.0.2 / 2015-05-05
88
159
 
89
160
  ### Bug fixes:
90
161
 
91
- * Fix error with `#to_text` when Loofah::Helpers hadn't been required. #75
92
- * Allow multi-word data attributes. #84 (Thanks, @jstorimer!)
93
- * Allow negative values in CSS properties. #85 (Thanks, @siddhartham!)
162
+ * Fix error with `#to_text` when Loofah::Helpers hadn't been required. [#75](https://github.com/flavorjones/loofah/issues/75)
163
+ * Allow multi-word data attributes. [#84](https://github.com/flavorjones/loofah/issues/84) (Thanks, [@jstorimer](https://github.com/jstorimer)!)
164
+ * Allow negative values in CSS properties. [#85](https://github.com/flavorjones/loofah/issues/85) (Thanks, [@siddhartham](https://github.com/siddhartham)!)
94
165
 
95
166
 
96
167
  ## 2.0.1 / 2014-08-21
97
168
 
98
169
  ### Bug fixes:
99
170
 
100
- * Load RR correctly when running test files directly. (Thanks, @ktdreyer!)
171
+ * Load RR correctly when running test files directly. (Thanks, [@ktdreyer](https://github.com/ktdreyer)!)
101
172
 
102
173
 
103
174
  ### Notes:
104
175
 
105
- * Extracted HTML5::Scrub#scrub_css_attribute to accommodate the Rails integration work. (Thanks, @kaspth!)
176
+ * Extracted HTML5::Scrub#scrub_css_attribute to accommodate the Rails integration work. (Thanks, [@kaspth](https://github.com/kaspth)!)
106
177
 
107
178
 
108
179
  ## 2.0.0 / 2014-05-09
@@ -118,19 +189,19 @@ This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
118
189
  * tags: `article`, `aside`, `bdi`, `bdo`, `canvas`, `command`, `datalist`, `details`, `figcaption`, `figure`, `footer`, `header`, `mark`, `meter`, `nav`, `output`, `section`, `summary`, `time`
119
190
  * attributes: `data-*` (Thanks, Rafael Franca!)
120
191
  * URI attributes: `poster` and `preload`
121
- * Addition of the `:unprintable` scrubber to remove unprintable characters from text nodes. #65 (Thanks, Matt Swanson!)
122
- * `Loofah.fragment` accepts an optional encoding argument, compatible with `Nokogiri::HTML::DocumentFragment.parse`. #62 (Thanks, Ben Atkins!)
192
+ * Addition of the `:unprintable` scrubber to remove unprintable characters from text nodes. [#65](https://github.com/flavorjones/loofah/issues/65) (Thanks, Matt Swanson!)
193
+ * `Loofah.fragment` accepts an optional encoding argument, compatible with `Nokogiri::HTML::DocumentFragment.parse`. [#62](https://github.com/flavorjones/loofah/issues/62) (Thanks, Ben Atkins!)
123
194
  * HTML5 sanitizers now remove attributes without values. (Thanks, Kasper Timm Hansen!)
124
195
 
125
196
  ### Bug fixes:
126
197
 
127
198
  * HTML5 sanitizers' CSS keyword check now actually works (broken in v2.0). Additional regression tests added. (Thanks, Kasper Timm Hansen!)
128
- * HTML5 sanitizers now allow negative arguments to CSS. #64 (Thanks, Jon Calhoun!)
199
+ * HTML5 sanitizers now allow negative arguments to CSS. [#64](https://github.com/flavorjones/loofah/issues/64) (Thanks, Jon Calhoun!)
129
200
 
130
201
 
131
202
  ## 1.2.1 (2012-04-14)
132
203
 
133
- * Declaring encoding in html5/scrub.rb. Without this, use of the ruby -KU option would cause havoc. (#32)
204
+ * 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))
134
205
 
135
206
 
136
207
  ## 1.2.0 (2011-08-08)
@@ -148,7 +219,7 @@ This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
148
219
  * Additional HTML5lib whitelist elements (from html5lib 1524:80b5efe26230).
149
220
  Up to date with HTML5lib ruby code as of 1723:7ee6a0331856.
150
221
  * Whitelists (which are not part of the public API) are now Sets (were previously Arrays).
151
- * Don't explode when encountering UTF-8 URIs. (#25, #29)
222
+ * Don't explode when encountering UTF-8 URIs. ([#25](https://github.com/flavorjones/loofah/issues/25), [#29](https://github.com/flavorjones/loofah/issues/29))
152
223
 
153
224
 
154
225
  ## 1.0.0 (2010-10-26)
@@ -166,7 +237,7 @@ This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
166
237
  * New methods Loofah::HTML::Document#to_text and
167
238
  Loofah::HTML::DocumentFragment#to_text do the right thing with
168
239
  whitespace. Note that these methods are significantly slower than
169
- #text. GH #12
240
+ #text. GH [#12](https://github.com/flavorjones/loofah/issues/12)
170
241
  * Loofah::Elements::BLOCK_LEVEL contains a canonical list of HTML4 block-level4 elements.
171
242
  * Loofah::HTML::Document#text and Loofah::HTML::DocumentFragment#text
172
243
  will return unescaped HTML entities by passing :encode_special_chars => false.
@@ -180,7 +251,7 @@ This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
180
251
 
181
252
  ### Bug fixes:
182
253
 
183
- * Loofah::XssFoliate was not properly escaping HTML entities when implicitly scrubbing a string attribute. GH #17
254
+ * Loofah::XssFoliate was not properly escaping HTML entities when implicitly scrubbing a string attribute. GH [#17](https://github.com/flavorjones/loofah/issues/17)
184
255
 
185
256
 
186
257
  ## 0.4.3 (2010-01-29)
@@ -208,7 +279,7 @@ This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
208
279
 
209
280
  ### Bug fixes:
210
281
 
211
- * Supporting Rails apps that aren't loading ActiveRecord. GH #10
282
+ * Supporting Rails apps that aren't loading ActiveRecord. GH [#10](https://github.com/flavorjones/loofah/issues/10)
212
283
 
213
284
  ### Miscellaneous:
214
285
 
@@ -269,13 +340,13 @@ This CVE's public notice is at https://github.com/flavorjones/loofah/issues/144
269
340
  ### Enhancements:
270
341
 
271
342
  * when loaded in a Rails app, automatically extend ActiveRecord::Base
272
- with html_fragment and html_document. GH #6 (Thanks Josh Nichols!)
343
+ with html_fragment and html_document. GH [#6](https://github.com/flavorjones/loofah/issues/6) (Thanks Josh Nichols!)
273
344
 
274
345
  ### Bugfixes:
275
346
 
276
347
  * ActiveRecord scrubbing should generate strings instead of Document or
277
- DocumentFragment objects. GH #5
278
- * init.rb fixed to support installation as a Rails plugin. GH #6
348
+ DocumentFragment objects. GH [#5](https://github.com/flavorjones/loofah/issues/5)
349
+ * init.rb fixed to support installation as a Rails plugin. GH [#6](https://github.com/flavorjones/loofah/issues/6)
279
350
  (Thanks Josh Nichols!)
280
351
 
281
352
 
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", ">=0.8", :group => [:development, :test]
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", ">=0", :group => [:development, :test]
14
- gem "hoe-gemspec", ">=0", :group => [:development, :test]
15
- gem "hoe-debugging", ">=0", :group => [:development, :test]
16
- gem "hoe-bundler", ">=0", :group => [:development, :test]
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]
13
+ gem "json", "~>2.2.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]
19
+ gem "concourse", ">=0.26.0", :group => [:development, :test]
20
+ gem "rubocop", ">=0.76.0", :group => [:development, :test]
21
+ gem "rdoc", ">=4.0", "<7", :group => [:development, :test]
22
+ gem "hoe", "~>3.22", :group => [:development, :test]
21
23
 
22
24
  # vim: syntax=ruby
@@ -1,4 +1,3 @@
1
- .gemtest
2
1
  CHANGELOG.md
3
2
  Gemfile
4
3
  MIT-LICENSE.txt
@@ -16,25 +15,11 @@ lib/loofah/helpers.rb
16
15
  lib/loofah/html/document.rb
17
16
  lib/loofah/html/document_fragment.rb
18
17
  lib/loofah/html5/libxml2_workarounds.rb
18
+ lib/loofah/html5/safelist.rb
19
19
  lib/loofah/html5/scrub.rb
20
- lib/loofah/html5/whitelist.rb
21
20
  lib/loofah/instance_methods.rb
22
21
  lib/loofah/metahelpers.rb
23
22
  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/integration/test_ad_hoc.rb
32
- test/integration/test_helpers.rb
33
- test/integration/test_html.rb
34
- test/integration/test_scrubbers.rb
35
- test/integration/test_xml.rb
36
- test/unit/test_api.rb
37
- test/unit/test_encoding.rb
38
- test/unit/test_helpers.rb
39
- test/unit/test_scrubber.rb
40
- test/unit/test_scrubbers.rb
data/README.md CHANGED
@@ -8,29 +8,22 @@
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
17
16
 
18
- Loofah is a general library for manipulating and transforming HTML/XML
19
- documents and fragments. It's built on top of Nokogiri and libxml2, so
20
- 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.
21
18
 
22
- Loofah excels at HTML sanitization (XSS prevention). It includes some
23
- nice HTML sanitizers, which are based on HTML5lib's whitelist, so it
24
- most likely won't make your codes less secure. (These statements have
25
- 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.)
26
20
 
27
- ActiveRecord extensions for sanitization are available in the
28
- [`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).
29
22
 
30
23
 
31
24
  ## Features
32
25
 
33
- * Easily write custom scrubbers for HTML/XML leveraging the sweetness of Nokogiri (and HTML5lib's whitelists).
26
+ * Easily write custom scrubbers for HTML/XML leveraging the sweetness of Nokogiri (and HTML5lib's safelists).
34
27
  * Common HTML sanitizing tasks are built-in:
35
28
  * _Strip_ unsafe tags, leaving behind only the inner text.
36
29
  * _Prune_ unsafe tags and their subtrees, removing all traces that they ever existed.
@@ -222,7 +215,7 @@ Loofah.xml_document(File.read('plague.xml')).scrub!(bring_out_your_dead)
222
215
  === Built-In HTML Scrubbers
223
216
 
224
217
  Loofah comes with a set of sanitizing scrubbers that use HTML5lib's
225
- whitelist algorithm:
218
+ safelist algorithm:
226
219
 
227
220
  ``` ruby
228
221
  doc.scrub!(:strip) # replaces unknown/unsafe tags with their inner text
data/Rakefile CHANGED
@@ -1,34 +1,40 @@
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
8
7
  Hoe.plugin :bundler
9
8
  Hoe.plugin :debugging
9
+ Hoe.plugin :markdown
10
10
 
11
11
  Hoe.spec "loofah" do
12
12
  developer "Mike Dalessio", "mike.dalessio@gmail.com"
13
13
  developer "Bryan Helmkamp", "bryan@brynary.com"
14
14
 
15
- self.extra_rdoc_files = FileList["*.md"]
16
- self.history_file = "CHANGELOG.md"
17
- self.readme_file = "README.md"
18
- self.license "MIT"
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
+ }
19
23
 
20
- extra_deps << ["nokogiri", ">=1.5.9"]
21
- extra_deps << ["crass", "~> 1.0.2"]
24
+ extra_deps << ["nokogiri", ">=1.5.9"]
25
+ extra_deps << ["crass", "~> 1.0.2"]
22
26
 
23
- extra_dev_deps << ["rake", ">=0.8"]
27
+ extra_dev_deps << ["rake", "~> 12.3"]
24
28
  extra_dev_deps << ["minitest", "~>2.2"]
25
29
  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"]
30
+ extra_dev_deps << ["json", "~> 2.2.0"]
31
+ extra_dev_deps << ["hoe-gemspec", "~> 1.0"]
32
+ extra_dev_deps << ["hoe-debugging", "~> 2.0"]
33
+ extra_dev_deps << ["hoe-bundler", "~> 1.5"]
34
+ extra_dev_deps << ["hoe-git", "~> 1.6"]
35
+ extra_dev_deps << ["hoe-markdown", "~> 1.2"]
36
+ extra_dev_deps << ["concourse", ">=0.26.0"]
37
+ extra_dev_deps << ["rubocop", ">=0.76.0"]
32
38
  end
33
39
 
34
40
  task :gemspec do
@@ -71,9 +77,21 @@ task :doc_upload_to_rubyforge => :docs do
71
77
  end
72
78
  end
73
79
 
74
- desc "generate whitelists from W3C specifications"
75
- task :generate_whitelists do
76
- load "tasks/generate-whitelists"
80
+ desc "generate safelists from W3C specifications"
81
+ task :generate_safelists do
82
+ load "tasks/generate-safelists"
77
83
  end
78
84
 
79
- Concourse.new("loofah").create_tasks!
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
+
94
+ Concourse.new("loofah", fly_target: "ci") do |c|
95
+ c.add_pipeline "loofah", "loofah.yml"
96
+ c.add_pipeline "loofah-pr", "loofah-pr.yml"
97
+ end