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
metadata CHANGED
@@ -1,182 +1,103 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: loofah
3
- version: !ruby/object:Gem::Version
4
- version: 0.4.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.25.0
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Mike Dalessio
8
8
  - Bryan Helmkamp
9
- autorequire:
10
9
  bindir: bin
11
- cert_chain:
12
- - |
13
- -----BEGIN CERTIFICATE-----
14
- MIIDPDCCAiSgAwIBAgIBADANBgkqhkiG9w0BAQUFADBEMRYwFAYDVQQDDA1taWtl
15
- LmRhbGVzc2lvMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZ
16
- FgNjb20wHhcNMDkwODExMDU0MjQ5WhcNMTAwODExMDU0MjQ5WjBEMRYwFAYDVQQD
17
- DA1taWtlLmRhbGVzc2lvMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJ
18
- k/IsZAEZFgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDANjr7
19
- lZ1DKtK8YvNp+5kBzIpwrpClHRrosqo01qmWfGBxZckQUtrJUwGPxpzvIHVq1VKp
20
- a9FXU/QWYek/1S0vhkOf9XGmFBnVCtbJhwGeyzsQFFSoQIfs2hd5gO0dSRpuKdi3
21
- slfJAXzFKg1u/7OCVPgrY/mkdh34MzL5p0gSDzPt7vLPibctHg0GoepYT5Fh1tMQ
22
- luzgrN0weTw/QoEWTMQcNk6CyUpzv0pOe7d0qEPQ9Lx7Lz64gIym3f0pKFpWLfME
23
- l7PFLeR95zw2zsuZQwCR5ma5zjXD3mo2jk1mVqiI8qplOL1u30FU7hRhTV5n/Qe9
24
- elDQoZW9Xz0R5JGDAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0G
25
- A1UdDgQWBBRXWlUJZXcR1jkZPE24+mjUTCqNxjANBgkqhkiG9w0BAQUFAAOCAQEA
26
- jDh5M41sg1MZKG1DXzQmo/IADeWRmXyb3EZaED9lhFFpoQqaralgpgmvuc0GswvO
27
- QIZijh03tPQz8lgp1U1OFZod2ZwbEVTtVZpxs1ssjMraOA6KzlsNROH0XonIiy6j
28
- r2Q0UF35ax8pvr3D5Y6AKzIW1F3aeiREylUDJlb/i1dPQ2PVK0yRrSQoK2epwM9E
29
- zoczlHTTJc/tRvH5Up3Agcv9y+J0U9a1Af9NRsnHPVBdo2H32MsJ99x5NRDWJmJg
30
- ohH37UR7njcc6j4fo22IwTqXaaXJdtVdAWjXP/xs5B3cPYSP6uqFnR46Jf86Iqj1
31
- FlqnTjy13J3nD30uxy9a1g==
32
- -----END CERTIFICATE-----
33
-
34
- date: 2010-01-23 00:00:00 -05:00
35
- default_executable:
36
- dependencies:
37
- - !ruby/object:Gem::Dependency
38
- name: nokogiri
10
+ cert_chain: []
11
+ date: 1980-01-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: crass
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.2
39
20
  type: :runtime
40
- version_requirement:
41
- version_requirements: !ruby/object:Gem::Requirement
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- version: 1.3.3
46
- version:
47
- - !ruby/object:Gem::Dependency
48
- name: mocha
49
- type: :development
50
- version_requirement:
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: "0.9"
56
- version:
57
- - !ruby/object:Gem::Dependency
58
- name: thoughtbot-shoulda
59
- type: :development
60
- version_requirement:
61
- version_requirements: !ruby/object:Gem::Requirement
62
- requirements:
63
- - - ">="
64
- - !ruby/object:Gem::Version
65
- version: "2.10"
66
- version:
67
- - !ruby/object:Gem::Dependency
68
- name: acts_as_fu
69
- type: :development
70
- version_requirement:
71
- version_requirements: !ruby/object:Gem::Requirement
72
- requirements:
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: nokogiri
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
73
31
  - - ">="
74
- - !ruby/object:Gem::Version
75
- version: 0.0.5
76
- version:
77
- - !ruby/object:Gem::Dependency
78
- name: hoe
79
- type: :development
80
- version_requirement:
81
- version_requirements: !ruby/object:Gem::Requirement
82
- requirements:
32
+ - !ruby/object:Gem::Version
33
+ version: 1.12.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
83
38
  - - ">="
84
- - !ruby/object:Gem::Version
85
- version: 2.3.3
86
- version:
87
- description: |-
88
- Loofah is a general library for manipulating HTML/XML documents and
89
- fragments. It's built on top of Nokogiri and libxml2, so it's fast and
90
- has a nice API.
91
-
92
- Loofah excels at HTML sanitization (XSS prevention). It includes some
93
- nice HTML sanitizers, which are based on HTML5lib's whitelist, so it
94
- most likely won't make your codes less secure. (These statements have
95
- not been evaluated by Netexperts.)
96
- email:
39
+ - !ruby/object:Gem::Version
40
+ version: 1.12.0
41
+ description: |
42
+ Loofah is a general library for manipulating and transforming HTML/XML documents and fragments,
43
+ built on top of Nokogiri.
44
+
45
+ Loofah also includes some HTML sanitizers based on `html5lib`'s safelist, which are a specific
46
+ application of the general transformation functionality.
47
+ email:
97
48
  - mike.dalessio@gmail.com
98
49
  - bryan@brynary.com
99
50
  executables: []
100
-
101
51
  extensions: []
102
-
103
- extra_rdoc_files:
52
+ extra_rdoc_files: []
53
+ files:
54
+ - CHANGELOG.md
104
55
  - MIT-LICENSE.txt
105
- - Manifest.txt
106
- - TODO.rdoc
107
- - CHANGELOG.rdoc
108
- - DEPRECATED.rdoc
109
- - README.rdoc
110
- files:
111
- - CHANGELOG.rdoc
112
- - DEPRECATED.rdoc
113
- - MIT-LICENSE.txt
114
- - Manifest.txt
115
- - README.rdoc
116
- - Rakefile
117
- - TODO.rdoc
118
- - benchmark/benchmark.rb
119
- - benchmark/fragment.html
120
- - benchmark/helper.rb
121
- - benchmark/www.slashdot.com.html
122
- - init.rb
56
+ - README.md
57
+ - SECURITY.md
123
58
  - lib/loofah.rb
124
- - lib/loofah/active_record.rb
59
+ - lib/loofah/concerns.rb
60
+ - lib/loofah/elements.rb
125
61
  - lib/loofah/helpers.rb
126
- - lib/loofah/html/document.rb
127
- - lib/loofah/html/document_fragment.rb
62
+ - lib/loofah/html4/document.rb
63
+ - lib/loofah/html4/document_fragment.rb
64
+ - lib/loofah/html5/document.rb
65
+ - lib/loofah/html5/document_fragment.rb
66
+ - lib/loofah/html5/libxml2_workarounds.rb
67
+ - lib/loofah/html5/safelist.rb
128
68
  - lib/loofah/html5/scrub.rb
129
- - lib/loofah/html5/whitelist.rb
130
- - lib/loofah/instance_methods.rb
69
+ - lib/loofah/metahelpers.rb
131
70
  - lib/loofah/scrubber.rb
132
71
  - lib/loofah/scrubbers.rb
72
+ - lib/loofah/version.rb
133
73
  - lib/loofah/xml/document.rb
134
74
  - lib/loofah/xml/document_fragment.rb
135
- - lib/loofah/xss_foliate.rb
136
- - test/helper.rb
137
- - test/html5/test_sanitizer.rb
138
- - test/test_active_record.rb
139
- - test/test_ad_hoc.rb
140
- - test/test_api.rb
141
- - test/test_helpers.rb
142
- - test/test_scrubber.rb
143
- - test/test_scrubbers.rb
144
- - test/test_xss_foliate.rb
145
- has_rdoc: true
146
- homepage: http://loofah.rubyforge.org
147
- licenses: []
148
-
149
- post_install_message:
150
- rdoc_options:
151
- - --main
152
- - README.rdoc
153
- require_paths:
75
+ homepage: https://github.com/flavorjones/loofah
76
+ licenses:
77
+ - MIT
78
+ metadata:
79
+ homepage_uri: https://github.com/flavorjones/loofah
80
+ source_code_uri: https://github.com/flavorjones/loofah
81
+ bug_tracker_uri: https://github.com/flavorjones/loofah/issues
82
+ changelog_uri: https://github.com/flavorjones/loofah/blob/main/CHANGELOG.md
83
+ documentation_uri: https://www.rubydoc.info/gems/loofah/
84
+ funding_uri: https://github.com/sponsors/flavorjones
85
+ rdoc_options: []
86
+ require_paths:
154
87
  - lib
155
- required_ruby_version: !ruby/object:Gem::Requirement
156
- requirements:
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
157
90
  - - ">="
158
- - !ruby/object:Gem::Version
159
- version: "0"
160
- version:
161
- required_rubygems_version: !ruby/object:Gem::Requirement
162
- requirements:
91
+ - !ruby/object:Gem::Version
92
+ version: 2.5.0
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
163
95
  - - ">="
164
- - !ruby/object:Gem::Version
165
- version: "0"
166
- version:
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
167
98
  requirements: []
168
-
169
- rubyforge_project: loofah
170
- rubygems_version: 1.3.5
171
- signing_key:
172
- specification_version: 3
173
- summary: Loofah is a general library for manipulating HTML/XML documents and fragments
174
- test_files:
175
- - test/test_xss_foliate.rb
176
- - test/test_helpers.rb
177
- - test/test_scrubber.rb
178
- - test/test_scrubbers.rb
179
- - test/test_api.rb
180
- - test/test_ad_hoc.rb
181
- - test/html5/test_sanitizer.rb
182
- - test/test_active_record.rb
99
+ rubygems_version: 3.6.9
100
+ specification_version: 4
101
+ summary: Loofah is a general library for manipulating and transforming HTML/XML documents
102
+ and fragments, built on top of Nokogiri.
103
+ test_files: []
data/CHANGELOG.rdoc DELETED
@@ -1,92 +0,0 @@
1
- = Changelog
2
-
3
- == 0.4.2 (2010-01-22)
4
-
5
- Enhancements:
6
-
7
- * Implemented Node#scrub! for scrubbing subtrees.
8
- * Implemented NodeSet#scrub! for scrubbing a set of subtrees.
9
- * Document.text now only serializes <body> contents (ignores <head>)
10
- * <head>, <html> and <body> added to the HTML5lib whitelist.
11
-
12
- Bug fixes:
13
-
14
- * Supporting Rails apps that aren't loading ActiveRecord. GH #10
15
-
16
- Miscellaneous:
17
-
18
- * Mailing list is now loofah@librelist.com / http://librelist.com
19
- * IRC channel is now \#loofah on freenode.
20
-
21
- == 0.4.1 (2009-11-23)
22
-
23
- Bugfix:
24
-
25
- * Manifest fixed. Whoops.
26
-
27
- == 0.4.0 (2009-11-21)
28
-
29
- Enhancements:
30
-
31
- * Scrubber class introduced, allowing development of custom scrubbers.
32
- * Added support for XML documents and fragments.
33
- * Added :nofollow HTML scrubber (thanks Luke Melia!)
34
- * Built-in scrubbing methods refactored to use Scrubber.
35
-
36
- == 0.3.1 (2009-10-12)
37
-
38
- Bug fixes:
39
-
40
- * Scrubbed Documents properly render html, head and body tags when serialized.
41
-
42
- == 0.3.0 (2009-10-06)
43
-
44
- Enhancements:
45
-
46
- * New ActiveRecord extension `xss_foliate`, a drop-in replacement for xss_terminate[http://github.com/look/xss_terminate/tree/master].
47
- * Replacement methods for Rails's helpers, Loofah::Rails.sanitize and Loofah::Rails.strip_tags.
48
- * Official support (and test coverage) for Rails versions 2.3, 2.2, 2.1, 2.0 and 1.2.
49
-
50
- Deprecations:
51
-
52
- * The methods strip_tags, whitewash, whitewash_document, sanitize, and
53
- sanitize_document have been deprecated. See DEPRECATED.rdoc for
54
- details on the equivalent calls with the post-0.2 API.
55
-
56
- == 0.2.2 (2009-09-30)
57
-
58
- Enhancements:
59
-
60
- * ActiveRecord extension scrubs fields in a before_validation callback
61
- (was previously in a before_save)
62
-
63
- == 0.2.1 (2009-09-19)
64
-
65
- Enhancements:
66
-
67
- * when loaded in a Rails app, automatically extend ActiveRecord::Base
68
- with html_fragment and html_document. GH #6 (Thanks Josh Nichols!)
69
-
70
- Bugfixes:
71
-
72
- * ActiveRecord scrubbing should generate strings instead of Document or
73
- DocumentFragment objects. GH #5
74
- * init.rb fixed to support installation as a Rails plugin. GH #6
75
- (Thanks Josh Nichols!)
76
-
77
- == 0.2.0 (2009-09-11)
78
-
79
- * Swank new API.
80
- * ActiveRecord extension.
81
- * Uses Nokogiri's Document and DocumentFragment for parsing.
82
- * Updated html5lib codes and tests to revision 1384:b9d3153d7be7.
83
- * Deprecated the Dryopteris sanitization methods. Will be removed in 0.3.0.
84
- * Documentation! Hey!
85
-
86
- == 0.1.2 (2009-04-30)
87
-
88
- * Added whitewashing -- removal of all attributes and namespaced nodes. You know, for microsofty HTML.
89
-
90
- == 0.1.0 (2009-02-10)
91
-
92
- * Birthday!
data/DEPRECATED.rdoc DELETED
@@ -1,12 +0,0 @@
1
- = Deprecations
2
-
3
- In Loofah 0.3.0, some methods have been deprecated. The following
4
- lists the equivalent calls with the post-0.2 API:
5
-
6
- * <tt>strip_tags(string_or_io)</tt> is now <tt>scrub_document(string_or_io, :prune).text</tt>
7
- * <tt>whitewash(string_or_io)</tt> is now <tt>scrub_fragment(string_or_io, :whitewash).to_s</tt>
8
- * <tt>whitewash_document(string_or_io)</tt> is now <tt>scrub_document(string_or_io, :whitewash).to_s</tt>
9
- * <tt>sanitize(string_or_io)</tt> is now <tt>scrub_fragment(string_or_io, :escape).to_xml</tt>
10
- * <tt>sanitize_document(string_or_io)</tt> is now <tt>scrub_document(string_or_io, :escape).to_xml</tt>
11
-
12
- Have a nice day.
data/Manifest.txt DELETED
@@ -1,34 +0,0 @@
1
- CHANGELOG.rdoc
2
- DEPRECATED.rdoc
3
- MIT-LICENSE.txt
4
- Manifest.txt
5
- README.rdoc
6
- Rakefile
7
- TODO.rdoc
8
- benchmark/benchmark.rb
9
- benchmark/fragment.html
10
- benchmark/helper.rb
11
- benchmark/www.slashdot.com.html
12
- init.rb
13
- lib/loofah.rb
14
- lib/loofah/active_record.rb
15
- lib/loofah/helpers.rb
16
- lib/loofah/html/document.rb
17
- lib/loofah/html/document_fragment.rb
18
- lib/loofah/html5/scrub.rb
19
- lib/loofah/html5/whitelist.rb
20
- lib/loofah/instance_methods.rb
21
- lib/loofah/scrubber.rb
22
- lib/loofah/scrubbers.rb
23
- lib/loofah/xml/document.rb
24
- lib/loofah/xml/document_fragment.rb
25
- lib/loofah/xss_foliate.rb
26
- test/helper.rb
27
- test/html5/test_sanitizer.rb
28
- test/test_active_record.rb
29
- test/test_ad_hoc.rb
30
- test/test_api.rb
31
- test/test_helpers.rb
32
- test/test_scrubber.rb
33
- test/test_scrubbers.rb
34
- test/test_xss_foliate.rb