vigiles 0.1.0.pre.beta3 → 0.1.0.pre.beta5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +10 -1
- data/lib/vigiles/archive/extras.rb +4 -3
- data/lib/vigiles/archive/metadata.rb +3 -2
- data/lib/vigiles/archive/request.rb +18 -4
- data/lib/vigiles/archive.rb +15 -3
- data/lib/vigiles/constants.rb +7 -0
- data/lib/vigiles/middleware/record_conversation.rb +6 -22
- data/lib/vigiles/spec.rb +1 -1
- data/lib/vigiles/utilities/uri.rb +18 -0
- data/lib/vigiles/version.rb +2 -2
- data/lib/vigiles.rb +5 -1
- data/sorbet/rbi/gems/{activemodel@7.0.5.rbi → actioncable@7.1.3.3.rbi} +2 -2
- data/sorbet/rbi/gems/actionmailbox@7.1.3.3.rbi +8 -0
- data/sorbet/rbi/gems/{activerecord@7.0.5.rbi → actionmailer@7.1.3.3.rbi} +2 -2
- data/sorbet/rbi/gems/actionpack@7.1.3.3.rbi +20046 -0
- data/sorbet/rbi/gems/actiontext@7.1.3.3.rbi +8 -0
- data/sorbet/rbi/gems/actionview@7.1.3.3.rbi +15953 -0
- data/sorbet/rbi/gems/activejob@7.1.3.3.rbi +8 -0
- data/sorbet/rbi/gems/activemodel@7.1.3.3.rbi +6657 -0
- data/sorbet/rbi/gems/activerecord@7.1.3.3.rbi +41520 -0
- data/sorbet/rbi/gems/activestorage@7.1.3.3.rbi +8 -0
- data/sorbet/rbi/gems/activesupport@7.1.3.3.rbi +20570 -0
- data/sorbet/rbi/gems/base64@0.2.0.rbi +508 -0
- data/sorbet/rbi/gems/bigdecimal@3.1.8.rbi +77 -0
- data/sorbet/rbi/gems/builder@3.2.4.rbi +8 -0
- data/sorbet/rbi/gems/connection_pool@2.4.1.rbi +8 -0
- data/sorbet/rbi/gems/crass@1.0.6.rbi +622 -0
- data/sorbet/rbi/gems/date@3.3.4.rbi +74 -0
- data/sorbet/rbi/gems/drb@2.2.1.rbi +1346 -0
- data/sorbet/rbi/gems/globalid@1.2.1.rbi +8 -0
- data/sorbet/rbi/gems/i18n@1.14.5.rbi +2358 -0
- data/sorbet/rbi/gems/io-console@0.7.2.rbi +8 -0
- data/sorbet/rbi/gems/loofah@2.22.0.rbi +1080 -0
- data/sorbet/rbi/gems/{i18n@1.14.1.rbi → mail@2.8.1.rbi} +2 -2
- data/sorbet/rbi/gems/marcel@1.0.4.rbi +8 -0
- data/sorbet/rbi/gems/mini_mime@1.1.5.rbi +8 -0
- data/sorbet/rbi/gems/mutex_m@0.2.0.rbi +93 -0
- data/sorbet/rbi/gems/net-imap@0.4.11.rbi +8 -0
- data/sorbet/rbi/gems/net-pop@0.1.2.rbi +8 -0
- data/sorbet/rbi/gems/net-protocol@0.2.2.rbi +291 -0
- data/sorbet/rbi/gems/net-smtp@0.5.0.rbi +8 -0
- data/sorbet/rbi/gems/nio4r@2.7.3.rbi +8 -0
- data/sorbet/rbi/gems/nokogiri@1.16.5.rbi +7310 -0
- data/sorbet/rbi/gems/psych@5.1.2.rbi +1768 -0
- data/sorbet/rbi/gems/rack-session@2.0.0.rbi +729 -0
- data/sorbet/rbi/gems/rack-test@2.1.0.rbi +749 -0
- data/sorbet/rbi/gems/rack@3.0.11.rbi +5195 -0
- data/sorbet/rbi/gems/rackup@2.1.0.rbi +406 -0
- data/sorbet/rbi/gems/rails-dom-testing@2.2.0.rbi +691 -0
- data/sorbet/rbi/gems/rails-html-sanitizer@1.6.0.rbi +721 -0
- data/sorbet/rbi/gems/rails@7.1.3.3.rbi +8 -0
- data/sorbet/rbi/gems/railties@7.1.3.3.rbi +2167 -0
- data/sorbet/rbi/gems/rdoc@6.6.3.1.rbi +12715 -0
- data/sorbet/rbi/gems/reline@0.5.7.rbi +8 -0
- data/sorbet/rbi/gems/stringio@3.1.0.rbi +8 -0
- data/sorbet/rbi/gems/timeout@0.4.1.rbi +148 -0
- data/sorbet/rbi/gems/webrick@1.8.1.rbi +2606 -0
- data/sorbet/rbi/gems/websocket-driver@0.7.6.rbi +8 -0
- data/sorbet/rbi/gems/websocket-extensions@0.1.5.rbi +8 -0
- data/sorbet/rbi/gems/zeitwerk@2.6.13.rbi +1003 -0
- data/vigiles.gemspec +1 -1
- metadata +54 -7
- data/sorbet/rbi/gems/activesupport@7.0.5.rbi +0 -14
@@ -0,0 +1,721 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `rails-html-sanitizer` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem rails-html-sanitizer`.
|
6
|
+
|
7
|
+
# source://rails-html-sanitizer//lib/rails-html-sanitizer.rb#14
|
8
|
+
module ActionView
|
9
|
+
class << self
|
10
|
+
# source://actionview/7.1.3.3/lib/action_view/deprecator.rb#4
|
11
|
+
def deprecator; end
|
12
|
+
|
13
|
+
# source://actionview/7.1.3.3/lib/action_view.rb#93
|
14
|
+
def eager_load!; end
|
15
|
+
|
16
|
+
# source://actionview/7.1.3.3/lib/action_view/gem_version.rb#5
|
17
|
+
def gem_version; end
|
18
|
+
|
19
|
+
# source://actionview/7.1.3.3/lib/action_view/version.rb#7
|
20
|
+
def version; end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# source://rails-html-sanitizer//lib/rails-html-sanitizer.rb#15
|
25
|
+
module ActionView::Helpers
|
26
|
+
include ::ActionView::Helpers::SanitizeHelper
|
27
|
+
include ::ActionView::Helpers::TextHelper
|
28
|
+
include ::ActionView::Helpers::UrlHelper
|
29
|
+
include ::ActionView::Helpers::SanitizeHelper
|
30
|
+
include ::ActionView::Helpers::TextHelper
|
31
|
+
include ::ActionView::Helpers::FormTagHelper
|
32
|
+
include ::ActionView::Helpers::FormHelper
|
33
|
+
include ::ActionView::Helpers::TranslationHelper
|
34
|
+
|
35
|
+
mixes_in_class_methods ::ActionView::Helpers::UrlHelper::ClassMethods
|
36
|
+
mixes_in_class_methods ::ActionView::Helpers::SanitizeHelper::ClassMethods
|
37
|
+
|
38
|
+
class << self
|
39
|
+
# source://actionview/7.1.3.3/lib/action_view/helpers.rb#35
|
40
|
+
def eager_load!; end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# source://rails-html-sanitizer//lib/rails-html-sanitizer.rb#16
|
45
|
+
module ActionView::Helpers::SanitizeHelper
|
46
|
+
mixes_in_class_methods ::ActionView::Helpers::SanitizeHelper::ClassMethods
|
47
|
+
|
48
|
+
# source://actionview/7.1.3.3/lib/action_view/helpers/sanitize_helper.rb#111
|
49
|
+
def sanitize(html, options = T.unsafe(nil)); end
|
50
|
+
|
51
|
+
# source://actionview/7.1.3.3/lib/action_view/helpers/sanitize_helper.rb#116
|
52
|
+
def sanitize_css(style); end
|
53
|
+
|
54
|
+
# source://actionview/7.1.3.3/lib/action_view/helpers/sanitize_helper.rb#12
|
55
|
+
def sanitizer_vendor; end
|
56
|
+
|
57
|
+
# source://actionview/7.1.3.3/lib/action_view/helpers/sanitize_helper.rb#12
|
58
|
+
def sanitizer_vendor=(val); end
|
59
|
+
|
60
|
+
# source://actionview/7.1.3.3/lib/action_view/helpers/sanitize_helper.rb#150
|
61
|
+
def strip_links(html); end
|
62
|
+
|
63
|
+
# source://actionview/7.1.3.3/lib/action_view/helpers/sanitize_helper.rb#133
|
64
|
+
def strip_tags(html); end
|
65
|
+
|
66
|
+
class << self
|
67
|
+
# source://actionview/7.1.3.3/lib/action_view/helpers/sanitize_helper.rb#12
|
68
|
+
def sanitizer_vendor; end
|
69
|
+
|
70
|
+
# source://actionview/7.1.3.3/lib/action_view/helpers/sanitize_helper.rb#12
|
71
|
+
def sanitizer_vendor=(val); end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# source://rails-html-sanitizer//lib/rails-html-sanitizer.rb#17
|
76
|
+
module ActionView::Helpers::SanitizeHelper::ClassMethods
|
77
|
+
# source://actionview/7.1.3.3/lib/action_view/helpers/sanitize_helper.rb#175
|
78
|
+
def full_sanitizer; end
|
79
|
+
|
80
|
+
# source://actionview/7.1.3.3/lib/action_view/helpers/sanitize_helper.rb#155
|
81
|
+
def full_sanitizer=(_arg0); end
|
82
|
+
|
83
|
+
# source://actionview/7.1.3.3/lib/action_view/helpers/sanitize_helper.rb#185
|
84
|
+
def link_sanitizer; end
|
85
|
+
|
86
|
+
# source://actionview/7.1.3.3/lib/action_view/helpers/sanitize_helper.rb#155
|
87
|
+
def link_sanitizer=(_arg0); end
|
88
|
+
|
89
|
+
# source://actionview/7.1.3.3/lib/action_view/helpers/sanitize_helper.rb#195
|
90
|
+
def safe_list_sanitizer; end
|
91
|
+
|
92
|
+
# source://actionview/7.1.3.3/lib/action_view/helpers/sanitize_helper.rb#155
|
93
|
+
def safe_list_sanitizer=(_arg0); end
|
94
|
+
|
95
|
+
# source://actionview/7.1.3.3/lib/action_view/helpers/sanitize_helper.rb#165
|
96
|
+
def sanitized_allowed_attributes; end
|
97
|
+
|
98
|
+
# Replaces the allowed HTML attributes for the +sanitize+ helper.
|
99
|
+
#
|
100
|
+
# class Application < Rails::Application
|
101
|
+
# config.action_view.sanitized_allowed_attributes = ['onclick', 'longdesc']
|
102
|
+
# end
|
103
|
+
#
|
104
|
+
# source://rails-html-sanitizer//lib/rails-html-sanitizer.rb#34
|
105
|
+
def sanitized_allowed_attributes=(attributes); end
|
106
|
+
|
107
|
+
# source://rails-html-sanitizer//lib/rails-html-sanitizer.rb#47
|
108
|
+
def sanitized_allowed_css_keywords; end
|
109
|
+
|
110
|
+
# source://rails-html-sanitizer//lib/rails-html-sanitizer.rb#48
|
111
|
+
def sanitized_allowed_css_keywords=(_); end
|
112
|
+
|
113
|
+
# source://rails-html-sanitizer//lib/rails-html-sanitizer.rb#47
|
114
|
+
def sanitized_allowed_css_properties; end
|
115
|
+
|
116
|
+
# source://rails-html-sanitizer//lib/rails-html-sanitizer.rb#48
|
117
|
+
def sanitized_allowed_css_properties=(_); end
|
118
|
+
|
119
|
+
# source://rails-html-sanitizer//lib/rails-html-sanitizer.rb#47
|
120
|
+
def sanitized_allowed_protocols; end
|
121
|
+
|
122
|
+
# source://rails-html-sanitizer//lib/rails-html-sanitizer.rb#48
|
123
|
+
def sanitized_allowed_protocols=(_); end
|
124
|
+
|
125
|
+
# source://actionview/7.1.3.3/lib/action_view/helpers/sanitize_helper.rb#161
|
126
|
+
def sanitized_allowed_tags; end
|
127
|
+
|
128
|
+
# Replaces the allowed tags for the +sanitize+ helper.
|
129
|
+
#
|
130
|
+
# class Application < Rails::Application
|
131
|
+
# config.action_view.sanitized_allowed_tags = 'table', 'tr', 'td'
|
132
|
+
# end
|
133
|
+
#
|
134
|
+
# source://rails-html-sanitizer//lib/rails-html-sanitizer.rb#24
|
135
|
+
def sanitized_allowed_tags=(tags); end
|
136
|
+
|
137
|
+
# source://rails-html-sanitizer//lib/rails-html-sanitizer.rb#47
|
138
|
+
def sanitized_bad_tags; end
|
139
|
+
|
140
|
+
# source://rails-html-sanitizer//lib/rails-html-sanitizer.rb#48
|
141
|
+
def sanitized_bad_tags=(_); end
|
142
|
+
|
143
|
+
# source://rails-html-sanitizer//lib/rails-html-sanitizer.rb#47
|
144
|
+
def sanitized_protocol_separator; end
|
145
|
+
|
146
|
+
# source://rails-html-sanitizer//lib/rails-html-sanitizer.rb#48
|
147
|
+
def sanitized_protocol_separator=(_); end
|
148
|
+
|
149
|
+
# source://rails-html-sanitizer//lib/rails-html-sanitizer.rb#47
|
150
|
+
def sanitized_shorthand_css_properties; end
|
151
|
+
|
152
|
+
# source://rails-html-sanitizer//lib/rails-html-sanitizer.rb#48
|
153
|
+
def sanitized_shorthand_css_properties=(_); end
|
154
|
+
|
155
|
+
# source://rails-html-sanitizer//lib/rails-html-sanitizer.rb#47
|
156
|
+
def sanitized_uri_attributes; end
|
157
|
+
|
158
|
+
# source://rails-html-sanitizer//lib/rails-html-sanitizer.rb#48
|
159
|
+
def sanitized_uri_attributes=(_); end
|
160
|
+
|
161
|
+
# source://actionview/7.1.3.3/lib/action_view/helpers/sanitize_helper.rb#157
|
162
|
+
def sanitizer_vendor; end
|
163
|
+
|
164
|
+
private
|
165
|
+
|
166
|
+
# source://rails-html-sanitizer//lib/rails-html-sanitizer.rb#52
|
167
|
+
def deprecate_option(name); end
|
168
|
+
end
|
169
|
+
|
170
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer/version.rb#3
|
171
|
+
module Rails
|
172
|
+
class << self
|
173
|
+
# source://railties/7.1.3.3/lib/rails/deprecator.rb#4
|
174
|
+
def deprecator; end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer/version.rb#4
|
179
|
+
module Rails::HTML; end
|
180
|
+
|
181
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#193
|
182
|
+
module Rails::HTML4; end
|
183
|
+
|
184
|
+
# == Rails::HTML4::FullSanitizer
|
185
|
+
#
|
186
|
+
# Removes all tags from HTML4 but strips out scripts, forms and comments.
|
187
|
+
#
|
188
|
+
# full_sanitizer = Rails::HTML4::FullSanitizer.new
|
189
|
+
# full_sanitizer.sanitize("<b>Bold</b> no more! <a href='more.html'>See more here</a>...")
|
190
|
+
# # => "Bold no more! See more here..."
|
191
|
+
#
|
192
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#224
|
193
|
+
class Rails::HTML4::FullSanitizer < ::Rails::HTML::Sanitizer
|
194
|
+
include ::Rails::HTML::Concern::ComposedSanitize
|
195
|
+
include ::Rails::HTML::Concern::Parser::HTML4
|
196
|
+
include ::Rails::HTML::Concern::Scrubber::Full
|
197
|
+
include ::Rails::HTML::Concern::Serializer::UTF8Encode
|
198
|
+
end
|
199
|
+
|
200
|
+
# == Rails::HTML4::LinkSanitizer
|
201
|
+
#
|
202
|
+
# Removes +a+ tags and +href+ attributes from HTML4 leaving only the link text.
|
203
|
+
#
|
204
|
+
# link_sanitizer = Rails::HTML4::LinkSanitizer.new
|
205
|
+
# link_sanitizer.sanitize('<a href="example.com">Only the link text will be kept.</a>')
|
206
|
+
# # => "Only the link text will be kept."
|
207
|
+
#
|
208
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#239
|
209
|
+
class Rails::HTML4::LinkSanitizer < ::Rails::HTML::Sanitizer
|
210
|
+
include ::Rails::HTML::Concern::ComposedSanitize
|
211
|
+
include ::Rails::HTML::Concern::Parser::HTML4
|
212
|
+
include ::Rails::HTML::Concern::Scrubber::Link
|
213
|
+
include ::Rails::HTML::Concern::Serializer::UTF8Encode
|
214
|
+
end
|
215
|
+
|
216
|
+
# == Rails::HTML4::SafeListSanitizer
|
217
|
+
#
|
218
|
+
# Sanitizes HTML4 and CSS from an extensive safe list.
|
219
|
+
#
|
220
|
+
# === Whitespace
|
221
|
+
#
|
222
|
+
# We can't make any guarantees about whitespace being kept or stripped. Loofah uses Nokogiri,
|
223
|
+
# which wraps either a C or Java parser for the respective Ruby implementation. Those two
|
224
|
+
# parsers determine how whitespace is ultimately handled.
|
225
|
+
#
|
226
|
+
# When the stripped markup will be rendered the users browser won't take whitespace into account
|
227
|
+
# anyway. It might be better to suggest your users wrap their whitespace sensitive content in
|
228
|
+
# pre tags or that you do so automatically.
|
229
|
+
#
|
230
|
+
# === Options
|
231
|
+
#
|
232
|
+
# Sanitizes both html and css via the safe lists found in
|
233
|
+
# Rails::HTML::Concern::Scrubber::SafeList
|
234
|
+
#
|
235
|
+
# SafeListSanitizer also accepts options to configure the safe list used when sanitizing html.
|
236
|
+
# There's a class level option:
|
237
|
+
#
|
238
|
+
# Rails::HTML4::SafeListSanitizer.allowed_tags = %w(table tr td)
|
239
|
+
# Rails::HTML4::SafeListSanitizer.allowed_attributes = %w(id class style)
|
240
|
+
#
|
241
|
+
# Tags and attributes can also be passed to +sanitize+. Passed options take precedence over the
|
242
|
+
# class level options.
|
243
|
+
#
|
244
|
+
# === Examples
|
245
|
+
#
|
246
|
+
# safe_list_sanitizer = Rails::HTML4::SafeListSanitizer.new
|
247
|
+
#
|
248
|
+
# # default: sanitize via a extensive safe list of allowed elements
|
249
|
+
# safe_list_sanitizer.sanitize(@article.body)
|
250
|
+
#
|
251
|
+
# # sanitize via the supplied tags and attributes
|
252
|
+
# safe_list_sanitizer.sanitize(
|
253
|
+
# @article.body,
|
254
|
+
# tags: %w(table tr td),
|
255
|
+
# attributes: %w(id class style),
|
256
|
+
# )
|
257
|
+
#
|
258
|
+
# # sanitize via a custom Loofah scrubber
|
259
|
+
# safe_list_sanitizer.sanitize(@article.body, scrubber: ArticleScrubber.new)
|
260
|
+
#
|
261
|
+
# # prune nodes from the tree instead of stripping tags and leaving inner content
|
262
|
+
# safe_list_sanitizer = Rails::HTML4::SafeListSanitizer.new(prune: true)
|
263
|
+
#
|
264
|
+
# # the sanitizer can also sanitize CSS
|
265
|
+
# safe_list_sanitizer.sanitize_css('background-color: #000;')
|
266
|
+
#
|
267
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#297
|
268
|
+
class Rails::HTML4::SafeListSanitizer < ::Rails::HTML::Sanitizer
|
269
|
+
include ::Rails::HTML::Concern::ComposedSanitize
|
270
|
+
include ::Rails::HTML::Concern::Parser::HTML4
|
271
|
+
include ::Rails::HTML::Concern::Scrubber::SafeList
|
272
|
+
include ::Rails::HTML::Concern::Serializer::UTF8Encode
|
273
|
+
|
274
|
+
class << self
|
275
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#144
|
276
|
+
def allowed_attributes; end
|
277
|
+
|
278
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#144
|
279
|
+
def allowed_attributes=(_arg0); end
|
280
|
+
|
281
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#143
|
282
|
+
def allowed_tags; end
|
283
|
+
|
284
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#143
|
285
|
+
def allowed_tags=(_arg0); end
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#194
|
290
|
+
module Rails::HTML4::Sanitizer
|
291
|
+
extend ::Rails::HTML4::Sanitizer::VendorMethods
|
292
|
+
end
|
293
|
+
|
294
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#195
|
295
|
+
module Rails::HTML4::Sanitizer::VendorMethods
|
296
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#196
|
297
|
+
def full_sanitizer; end
|
298
|
+
|
299
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#200
|
300
|
+
def link_sanitizer; end
|
301
|
+
|
302
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#204
|
303
|
+
def safe_list_sanitizer; end
|
304
|
+
|
305
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#208
|
306
|
+
def white_list_sanitizer; end
|
307
|
+
end
|
308
|
+
|
309
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#305
|
310
|
+
module Rails::HTML5; end
|
311
|
+
|
312
|
+
# == Rails::HTML5::FullSanitizer
|
313
|
+
#
|
314
|
+
# Removes all tags from HTML5 but strips out scripts, forms and comments.
|
315
|
+
#
|
316
|
+
# full_sanitizer = Rails::HTML5::FullSanitizer.new
|
317
|
+
# full_sanitizer.sanitize("<b>Bold</b> no more! <a href='more.html'>See more here</a>...")
|
318
|
+
# # => "Bold no more! See more here..."
|
319
|
+
#
|
320
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#334
|
321
|
+
class Rails::HTML5::FullSanitizer < ::Rails::HTML::Sanitizer
|
322
|
+
include ::Rails::HTML::Concern::ComposedSanitize
|
323
|
+
include ::Rails::HTML::Concern::Parser::HTML5
|
324
|
+
include ::Rails::HTML::Concern::Scrubber::Full
|
325
|
+
include ::Rails::HTML::Concern::Serializer::UTF8Encode
|
326
|
+
end
|
327
|
+
|
328
|
+
# == Rails::HTML5::LinkSanitizer
|
329
|
+
#
|
330
|
+
# Removes +a+ tags and +href+ attributes from HTML5 leaving only the link text.
|
331
|
+
#
|
332
|
+
# link_sanitizer = Rails::HTML5::LinkSanitizer.new
|
333
|
+
# link_sanitizer.sanitize('<a href="example.com">Only the link text will be kept.</a>')
|
334
|
+
# # => "Only the link text will be kept."
|
335
|
+
#
|
336
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#349
|
337
|
+
class Rails::HTML5::LinkSanitizer < ::Rails::HTML::Sanitizer
|
338
|
+
include ::Rails::HTML::Concern::ComposedSanitize
|
339
|
+
include ::Rails::HTML::Concern::Parser::HTML5
|
340
|
+
include ::Rails::HTML::Concern::Scrubber::Link
|
341
|
+
include ::Rails::HTML::Concern::Serializer::UTF8Encode
|
342
|
+
end
|
343
|
+
|
344
|
+
# == Rails::HTML5::SafeListSanitizer
|
345
|
+
#
|
346
|
+
# Sanitizes HTML5 and CSS from an extensive safe list.
|
347
|
+
#
|
348
|
+
# === Whitespace
|
349
|
+
#
|
350
|
+
# We can't make any guarantees about whitespace being kept or stripped. Loofah uses Nokogiri,
|
351
|
+
# which wraps either a C or Java parser for the respective Ruby implementation. Those two
|
352
|
+
# parsers determine how whitespace is ultimately handled.
|
353
|
+
#
|
354
|
+
# When the stripped markup will be rendered the users browser won't take whitespace into account
|
355
|
+
# anyway. It might be better to suggest your users wrap their whitespace sensitive content in
|
356
|
+
# pre tags or that you do so automatically.
|
357
|
+
#
|
358
|
+
# === Options
|
359
|
+
#
|
360
|
+
# Sanitizes both html and css via the safe lists found in
|
361
|
+
# Rails::HTML::Concern::Scrubber::SafeList
|
362
|
+
#
|
363
|
+
# SafeListSanitizer also accepts options to configure the safe list used when sanitizing html.
|
364
|
+
# There's a class level option:
|
365
|
+
#
|
366
|
+
# Rails::HTML5::SafeListSanitizer.allowed_tags = %w(table tr td)
|
367
|
+
# Rails::HTML5::SafeListSanitizer.allowed_attributes = %w(id class style)
|
368
|
+
#
|
369
|
+
# Tags and attributes can also be passed to +sanitize+. Passed options take precedence over the
|
370
|
+
# class level options.
|
371
|
+
#
|
372
|
+
# === Examples
|
373
|
+
#
|
374
|
+
# safe_list_sanitizer = Rails::HTML5::SafeListSanitizer.new
|
375
|
+
#
|
376
|
+
# # default: sanitize via a extensive safe list of allowed elements
|
377
|
+
# safe_list_sanitizer.sanitize(@article.body)
|
378
|
+
#
|
379
|
+
# # sanitize via the supplied tags and attributes
|
380
|
+
# safe_list_sanitizer.sanitize(
|
381
|
+
# @article.body,
|
382
|
+
# tags: %w(table tr td),
|
383
|
+
# attributes: %w(id class style),
|
384
|
+
# )
|
385
|
+
#
|
386
|
+
# # sanitize via a custom Loofah scrubber
|
387
|
+
# safe_list_sanitizer.sanitize(@article.body, scrubber: ArticleScrubber.new)
|
388
|
+
#
|
389
|
+
# # prune nodes from the tree instead of stripping tags and leaving inner content
|
390
|
+
# safe_list_sanitizer = Rails::HTML5::SafeListSanitizer.new(prune: true)
|
391
|
+
#
|
392
|
+
# # the sanitizer can also sanitize CSS
|
393
|
+
# safe_list_sanitizer.sanitize_css('background-color: #000;')
|
394
|
+
#
|
395
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#407
|
396
|
+
class Rails::HTML5::SafeListSanitizer < ::Rails::HTML::Sanitizer
|
397
|
+
include ::Rails::HTML::Concern::ComposedSanitize
|
398
|
+
include ::Rails::HTML::Concern::Parser::HTML5
|
399
|
+
include ::Rails::HTML::Concern::Scrubber::SafeList
|
400
|
+
include ::Rails::HTML::Concern::Serializer::UTF8Encode
|
401
|
+
|
402
|
+
class << self
|
403
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#144
|
404
|
+
def allowed_attributes; end
|
405
|
+
|
406
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#144
|
407
|
+
def allowed_attributes=(_arg0); end
|
408
|
+
|
409
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#143
|
410
|
+
def allowed_tags; end
|
411
|
+
|
412
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#143
|
413
|
+
def allowed_tags=(_arg0); end
|
414
|
+
end
|
415
|
+
end
|
416
|
+
|
417
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#306
|
418
|
+
class Rails::HTML5::Sanitizer
|
419
|
+
class << self
|
420
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#308
|
421
|
+
def full_sanitizer; end
|
422
|
+
|
423
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#312
|
424
|
+
def link_sanitizer; end
|
425
|
+
|
426
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#316
|
427
|
+
def safe_list_sanitizer; end
|
428
|
+
|
429
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#320
|
430
|
+
def white_list_sanitizer; end
|
431
|
+
end
|
432
|
+
end
|
433
|
+
|
434
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#33
|
435
|
+
module Rails::HTML::Concern; end
|
436
|
+
|
437
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#34
|
438
|
+
module Rails::HTML::Concern::ComposedSanitize
|
439
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#35
|
440
|
+
def sanitize(html, options = T.unsafe(nil)); end
|
441
|
+
end
|
442
|
+
|
443
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#43
|
444
|
+
module Rails::HTML::Concern::Parser; end
|
445
|
+
|
446
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#44
|
447
|
+
module Rails::HTML::Concern::Parser::HTML4
|
448
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#45
|
449
|
+
def parse_fragment(html); end
|
450
|
+
end
|
451
|
+
|
452
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#50
|
453
|
+
module Rails::HTML::Concern::Parser::HTML5
|
454
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#51
|
455
|
+
def parse_fragment(html); end
|
456
|
+
end
|
457
|
+
|
458
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#57
|
459
|
+
module Rails::HTML::Concern::Scrubber; end
|
460
|
+
|
461
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#58
|
462
|
+
module Rails::HTML::Concern::Scrubber::Full
|
463
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#59
|
464
|
+
def scrub(fragment, options = T.unsafe(nil)); end
|
465
|
+
end
|
466
|
+
|
467
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#64
|
468
|
+
module Rails::HTML::Concern::Scrubber::Link
|
469
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#65
|
470
|
+
def initialize; end
|
471
|
+
|
472
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#72
|
473
|
+
def scrub(fragment, options = T.unsafe(nil)); end
|
474
|
+
end
|
475
|
+
|
476
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#77
|
477
|
+
module Rails::HTML::Concern::Scrubber::SafeList
|
478
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#151
|
479
|
+
def initialize(prune: T.unsafe(nil)); end
|
480
|
+
|
481
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#168
|
482
|
+
def sanitize_css(style_string); end
|
483
|
+
|
484
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#155
|
485
|
+
def scrub(fragment, options = T.unsafe(nil)); end
|
486
|
+
|
487
|
+
private
|
488
|
+
|
489
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#177
|
490
|
+
def allowed_attributes(options); end
|
491
|
+
|
492
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#173
|
493
|
+
def allowed_tags(options); end
|
494
|
+
|
495
|
+
class << self
|
496
|
+
# @private
|
497
|
+
#
|
498
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#141
|
499
|
+
def included(klass); end
|
500
|
+
end
|
501
|
+
end
|
502
|
+
|
503
|
+
# The default safe list for attributes
|
504
|
+
#
|
505
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#125
|
506
|
+
Rails::HTML::Concern::Scrubber::SafeList::DEFAULT_ALLOWED_ATTRIBUTES = T.let(T.unsafe(nil), Set)
|
507
|
+
|
508
|
+
# The default safe list for tags
|
509
|
+
#
|
510
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#79
|
511
|
+
Rails::HTML::Concern::Scrubber::SafeList::DEFAULT_ALLOWED_TAGS = T.let(T.unsafe(nil), Set)
|
512
|
+
|
513
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#183
|
514
|
+
module Rails::HTML::Concern::Serializer; end
|
515
|
+
|
516
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#184
|
517
|
+
module Rails::HTML::Concern::Serializer::UTF8Encode
|
518
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#185
|
519
|
+
def serialize(fragment); end
|
520
|
+
end
|
521
|
+
|
522
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#417
|
523
|
+
Rails::HTML::FullSanitizer = Rails::HTML4::FullSanitizer
|
524
|
+
|
525
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#418
|
526
|
+
Rails::HTML::LinkSanitizer = Rails::HTML4::LinkSanitizer
|
527
|
+
|
528
|
+
# === Rails::HTML::PermitScrubber
|
529
|
+
#
|
530
|
+
# +Rails::HTML::PermitScrubber+ allows you to permit only your own tags and/or attributes.
|
531
|
+
#
|
532
|
+
# +Rails::HTML::PermitScrubber+ can be subclassed to determine:
|
533
|
+
# - When a node should be skipped via +skip_node?+.
|
534
|
+
# - When a node is allowed via +allowed_node?+.
|
535
|
+
# - When an attribute should be scrubbed via +scrub_attribute?+.
|
536
|
+
#
|
537
|
+
# Subclasses don't need to worry if tags or attributes are set or not.
|
538
|
+
# If tags or attributes are not set, Loofah's behavior will be used.
|
539
|
+
# If you override +allowed_node?+ and no tags are set, it will not be called.
|
540
|
+
# Instead Loofahs behavior will be used.
|
541
|
+
# Likewise for +scrub_attribute?+ and attributes respectively.
|
542
|
+
#
|
543
|
+
# Text and CDATA nodes are skipped by default.
|
544
|
+
# Unallowed elements will be stripped, i.e. element is removed but its subtree kept.
|
545
|
+
# Supplied tags and attributes should be Enumerables.
|
546
|
+
#
|
547
|
+
# +tags=+
|
548
|
+
# If set, elements excluded will be stripped.
|
549
|
+
# If not, elements are stripped based on Loofahs +HTML5::Scrub.allowed_element?+.
|
550
|
+
#
|
551
|
+
# +attributes=+
|
552
|
+
# If set, attributes excluded will be removed.
|
553
|
+
# If not, attributes are removed based on Loofahs +HTML5::Scrub.scrub_attributes+.
|
554
|
+
#
|
555
|
+
# class CommentScrubber < Rails::HTML::PermitScrubber
|
556
|
+
# def initialize
|
557
|
+
# super
|
558
|
+
# self.tags = %w(form script comment blockquote)
|
559
|
+
# end
|
560
|
+
#
|
561
|
+
# def skip_node?(node)
|
562
|
+
# node.text?
|
563
|
+
# end
|
564
|
+
#
|
565
|
+
# def scrub_attribute?(name)
|
566
|
+
# name == "style"
|
567
|
+
# end
|
568
|
+
# end
|
569
|
+
#
|
570
|
+
# See the documentation for +Nokogiri::XML::Node+ to understand what's possible
|
571
|
+
# with nodes: https://nokogiri.org/rdoc/Nokogiri/XML/Node.html
|
572
|
+
#
|
573
|
+
# source://rails-html-sanitizer//lib/rails/html/scrubbers.rb#49
|
574
|
+
class Rails::HTML::PermitScrubber < ::Loofah::Scrubber
|
575
|
+
# @return [PermitScrubber] a new instance of PermitScrubber
|
576
|
+
#
|
577
|
+
# source://rails-html-sanitizer//lib/rails/html/scrubbers.rb#52
|
578
|
+
def initialize(prune: T.unsafe(nil)); end
|
579
|
+
|
580
|
+
# Returns the value of attribute attributes.
|
581
|
+
#
|
582
|
+
# source://rails-html-sanitizer//lib/rails/html/scrubbers.rb#50
|
583
|
+
def attributes; end
|
584
|
+
|
585
|
+
# source://rails-html-sanitizer//lib/rails/html/scrubbers.rb#62
|
586
|
+
def attributes=(attributes); end
|
587
|
+
|
588
|
+
# Returns the value of attribute prune.
|
589
|
+
#
|
590
|
+
# source://rails-html-sanitizer//lib/rails/html/scrubbers.rb#50
|
591
|
+
def prune; end
|
592
|
+
|
593
|
+
# source://rails-html-sanitizer//lib/rails/html/scrubbers.rb#66
|
594
|
+
def scrub(node); end
|
595
|
+
|
596
|
+
# Returns the value of attribute tags.
|
597
|
+
#
|
598
|
+
# source://rails-html-sanitizer//lib/rails/html/scrubbers.rb#50
|
599
|
+
def tags; end
|
600
|
+
|
601
|
+
# source://rails-html-sanitizer//lib/rails/html/scrubbers.rb#58
|
602
|
+
def tags=(tags); end
|
603
|
+
|
604
|
+
protected
|
605
|
+
|
606
|
+
# @return [Boolean]
|
607
|
+
#
|
608
|
+
# source://rails-html-sanitizer//lib/rails/html/scrubbers.rb#82
|
609
|
+
def allowed_node?(node); end
|
610
|
+
|
611
|
+
# @return [Boolean]
|
612
|
+
#
|
613
|
+
# source://rails-html-sanitizer//lib/rails/html/scrubbers.rb#94
|
614
|
+
def keep_node?(node); end
|
615
|
+
|
616
|
+
# source://rails-html-sanitizer//lib/rails/html/scrubbers.rb#136
|
617
|
+
def scrub_attribute(node, attr_node); end
|
618
|
+
|
619
|
+
# @return [Boolean]
|
620
|
+
#
|
621
|
+
# source://rails-html-sanitizer//lib/rails/html/scrubbers.rb#90
|
622
|
+
def scrub_attribute?(name); end
|
623
|
+
|
624
|
+
# source://rails-html-sanitizer//lib/rails/html/scrubbers.rb#107
|
625
|
+
def scrub_attributes(node); end
|
626
|
+
|
627
|
+
# source://rails-html-sanitizer//lib/rails/html/scrubbers.rb#120
|
628
|
+
def scrub_css_attribute(node); end
|
629
|
+
|
630
|
+
# source://rails-html-sanitizer//lib/rails/html/scrubbers.rb#102
|
631
|
+
def scrub_node(node); end
|
632
|
+
|
633
|
+
# @return [Boolean]
|
634
|
+
#
|
635
|
+
# source://rails-html-sanitizer//lib/rails/html/scrubbers.rb#86
|
636
|
+
def skip_node?(node); end
|
637
|
+
|
638
|
+
# source://rails-html-sanitizer//lib/rails/html/scrubbers.rb#129
|
639
|
+
def validate!(var, name); end
|
640
|
+
end
|
641
|
+
|
642
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#419
|
643
|
+
Rails::HTML::SafeListSanitizer = Rails::HTML4::SafeListSanitizer
|
644
|
+
|
645
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer/version.rb#5
|
646
|
+
class Rails::HTML::Sanitizer
|
647
|
+
extend ::Rails::HTML4::Sanitizer::VendorMethods
|
648
|
+
|
649
|
+
# @raise [NotImplementedError]
|
650
|
+
#
|
651
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#18
|
652
|
+
def sanitize(html, options = T.unsafe(nil)); end
|
653
|
+
|
654
|
+
private
|
655
|
+
|
656
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#28
|
657
|
+
def properly_encode(fragment, options); end
|
658
|
+
|
659
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#23
|
660
|
+
def remove_xpaths(node, xpaths); end
|
661
|
+
|
662
|
+
class << self
|
663
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#13
|
664
|
+
def best_supported_vendor; end
|
665
|
+
|
666
|
+
# @return [Boolean]
|
667
|
+
#
|
668
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#7
|
669
|
+
def html5_support?; end
|
670
|
+
end
|
671
|
+
end
|
672
|
+
|
673
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer/version.rb#6
|
674
|
+
Rails::HTML::Sanitizer::VERSION = T.let(T.unsafe(nil), String)
|
675
|
+
|
676
|
+
# === Rails::HTML::TargetScrubber
|
677
|
+
#
|
678
|
+
# Where +Rails::HTML::PermitScrubber+ picks out tags and attributes to permit in
|
679
|
+
# sanitization, +Rails::HTML::TargetScrubber+ targets them for removal.
|
680
|
+
#
|
681
|
+
# +tags=+
|
682
|
+
# If set, elements included will be stripped.
|
683
|
+
#
|
684
|
+
# +attributes=+
|
685
|
+
# If set, attributes included will be removed.
|
686
|
+
#
|
687
|
+
# source://rails-html-sanitizer//lib/rails/html/scrubbers.rb#171
|
688
|
+
class Rails::HTML::TargetScrubber < ::Rails::HTML::PermitScrubber
|
689
|
+
# @return [Boolean]
|
690
|
+
#
|
691
|
+
# source://rails-html-sanitizer//lib/rails/html/scrubbers.rb#172
|
692
|
+
def allowed_node?(node); end
|
693
|
+
|
694
|
+
# @return [Boolean]
|
695
|
+
#
|
696
|
+
# source://rails-html-sanitizer//lib/rails/html/scrubbers.rb#176
|
697
|
+
def scrub_attribute?(name); end
|
698
|
+
end
|
699
|
+
|
700
|
+
# === Rails::HTML::TextOnlyScrubber
|
701
|
+
#
|
702
|
+
# +Rails::HTML::TextOnlyScrubber+ allows you to permit text nodes.
|
703
|
+
#
|
704
|
+
# Unallowed elements will be stripped, i.e. element is removed but its subtree kept.
|
705
|
+
#
|
706
|
+
# source://rails-html-sanitizer//lib/rails/html/scrubbers.rb#186
|
707
|
+
class Rails::HTML::TextOnlyScrubber < ::Loofah::Scrubber
|
708
|
+
# @return [TextOnlyScrubber] a new instance of TextOnlyScrubber
|
709
|
+
#
|
710
|
+
# source://rails-html-sanitizer//lib/rails/html/scrubbers.rb#187
|
711
|
+
def initialize; end
|
712
|
+
|
713
|
+
# source://rails-html-sanitizer//lib/rails/html/scrubbers.rb#191
|
714
|
+
def scrub(node); end
|
715
|
+
end
|
716
|
+
|
717
|
+
# source://rails-html-sanitizer//lib/rails/html/sanitizer.rb#420
|
718
|
+
Rails::HTML::WhiteListSanitizer = Rails::HTML4::SafeListSanitizer
|
719
|
+
|
720
|
+
# source://rails-html-sanitizer//lib/rails-html-sanitizer.rb#11
|
721
|
+
Rails::Html = Rails::HTML
|