danger-packwerk 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/danger-packwerk/packwerk_wrapper.rb +2 -2
- data/lib/danger-packwerk/version.rb +1 -1
- data/sorbet/config +1 -0
- data/sorbet/rbi/gems/actionview@7.0.4.rbi +11543 -0
- data/sorbet/rbi/gems/activesupport@7.0.4.rbi +12959 -0
- data/sorbet/rbi/gems/addressable@2.8.1.rbi +1505 -0
- data/sorbet/rbi/gems/ast@2.4.2.rbi +522 -0
- data/sorbet/rbi/gems/better_html@2.0.1.rbi +286 -0
- data/sorbet/rbi/gems/builder@3.2.4.rbi +8 -0
- data/sorbet/rbi/gems/claide-plugins@0.9.2.rbi +791 -0
- data/sorbet/rbi/gems/claide@1.1.0.rbi +1132 -0
- data/sorbet/rbi/gems/coderay@1.1.3.rbi +2256 -0
- data/sorbet/rbi/gems/colored2@3.1.2.rbi +130 -0
- data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +8695 -0
- data/sorbet/rbi/gems/cork@0.3.0.rbi +248 -0
- data/sorbet/rbi/gems/crass@1.0.6.rbi +436 -0
- data/sorbet/rbi/gems/danger-plugin-api@1.0.0.rbi +8 -0
- data/sorbet/rbi/gems/danger@9.0.0.rbi +4722 -0
- data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +862 -0
- data/sorbet/rbi/gems/erubi@1.11.0.rbi +102 -0
- data/sorbet/rbi/gems/faraday-em_http@1.0.0.rbi +266 -0
- data/sorbet/rbi/gems/faraday-em_synchrony@1.0.0.rbi +209 -0
- data/sorbet/rbi/gems/faraday-excon@1.1.0.rbi +212 -0
- data/sorbet/rbi/gems/faraday-http-cache@2.4.1.rbi +805 -0
- data/sorbet/rbi/gems/faraday-httpclient@1.0.1.rbi +221 -0
- data/sorbet/rbi/gems/faraday-multipart@1.0.4.rbi +266 -0
- data/sorbet/rbi/gems/faraday-net_http@1.0.1.rbi +216 -0
- data/sorbet/rbi/gems/faraday-net_http_persistent@1.2.0.rbi +206 -0
- data/sorbet/rbi/gems/faraday-patron@1.0.0.rbi +212 -0
- data/sorbet/rbi/gems/faraday-rack@1.0.0.rbi +225 -0
- data/sorbet/rbi/gems/faraday-retry@1.0.3.rbi +222 -0
- data/sorbet/rbi/gems/faraday@1.10.2.rbi +1862 -0
- data/sorbet/rbi/gems/git@1.12.0.rbi +1936 -0
- data/sorbet/rbi/gems/i18n@1.12.0.rbi +1643 -0
- data/sorbet/rbi/gems/json@2.6.2.rbi +1418 -0
- data/sorbet/rbi/gems/kramdown-parser-gfm@1.1.0.rbi +8 -0
- data/sorbet/rbi/gems/kramdown@2.4.0.rbi +2168 -0
- data/sorbet/rbi/gems/loofah@2.19.0.rbi +646 -0
- data/sorbet/rbi/gems/method_source@1.0.0.rbi +199 -0
- data/sorbet/rbi/gems/minitest@5.16.3.rbi +997 -0
- data/sorbet/rbi/gems/multipart-post@2.2.3.rbi +165 -0
- data/sorbet/rbi/gems/nap@1.1.0.rbi +351 -0
- data/sorbet/rbi/gems/no_proxy_fix@0.1.2.rbi +8 -0
- data/sorbet/rbi/gems/nokogiri@1.13.8.rbi +4916 -0
- data/sorbet/rbi/gems/octokit@5.6.1.rbi +8939 -0
- data/sorbet/rbi/gems/open4@1.3.4.rbi +8 -0
- data/sorbet/rbi/gems/{packwerk@2.1.1.rbi → packwerk@2.2.1.rbi} +602 -51
- data/sorbet/rbi/gems/parallel@1.22.1.rbi +163 -0
- data/sorbet/rbi/gems/parser@3.1.2.1.rbi +5988 -0
- data/sorbet/rbi/gems/pry@0.14.1.rbi +6969 -0
- data/sorbet/rbi/gems/public_suffix@5.0.0.rbi +779 -0
- data/sorbet/rbi/gems/racc@1.6.0.rbi +92 -0
- data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +8 -0
- data/sorbet/rbi/gems/rails-html-sanitizer@1.4.3.rbi +493 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +227 -0
- data/sorbet/rbi/gems/rake@13.0.6.rbi +1865 -0
- data/sorbet/rbi/gems/rbi@0.0.14.rbi +2337 -0
- data/sorbet/rbi/gems/rchardet@1.8.0.rbi +587 -0
- data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +1851 -0
- data/sorbet/rbi/gems/rexml@3.2.5.rbi +3852 -0
- data/sorbet/rbi/gems/rspec-core@3.11.0.rbi +7725 -0
- data/sorbet/rbi/gems/rspec-expectations@3.11.0.rbi +6201 -0
- data/sorbet/rbi/gems/rspec-mocks@3.11.1.rbi +3625 -0
- data/sorbet/rbi/gems/rspec-support@3.11.0.rbi +1176 -0
- data/sorbet/rbi/gems/rspec@3.11.0.rbi +40 -0
- data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +4193 -0
- data/sorbet/rbi/gems/rubocop-sorbet@0.6.8.rbi +677 -0
- data/sorbet/rbi/gems/rubocop@1.36.0.rbi +37914 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +732 -0
- data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +8 -0
- data/sorbet/rbi/gems/sawyer@0.9.2.rbi +513 -0
- data/sorbet/rbi/gems/smart_properties@1.17.0.rbi +326 -0
- data/sorbet/rbi/gems/spoom@1.1.11.rbi +1600 -0
- data/sorbet/rbi/gems/tapioca@0.8.0.rbi +1959 -0
- data/sorbet/rbi/gems/terminal-table@3.0.2.rbi +438 -0
- data/sorbet/rbi/gems/thor@1.2.1.rbi +2921 -0
- data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +4879 -0
- data/sorbet/rbi/gems/unicode-display_width@2.3.0.rbi +27 -0
- data/sorbet/rbi/gems/unparser@0.6.5.rbi +2789 -0
- data/sorbet/rbi/gems/webrick@1.7.0.rbi +1802 -0
- data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +288 -0
- data/sorbet/rbi/gems/yard@0.9.27.rbi +12668 -0
- data/sorbet/rbi/todo.rbi +122 -0
- metadata +84 -7
- data/sorbet/rbi/gems/danger@8.5.0.rbi +0 -122
@@ -0,0 +1,92 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `racc` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem racc`.
|
6
|
+
|
7
|
+
ParseError = Racc::ParseError
|
8
|
+
Racc::Copyright = T.let(T.unsafe(nil), String)
|
9
|
+
|
10
|
+
class Racc::Parser
|
11
|
+
def _racc_do_parse_rb(arg, in_debug); end
|
12
|
+
def _racc_do_reduce(arg, act); end
|
13
|
+
|
14
|
+
# common
|
15
|
+
def _racc_evalact(act, arg); end
|
16
|
+
|
17
|
+
def _racc_init_sysvars; end
|
18
|
+
def _racc_setup; end
|
19
|
+
def _racc_yyparse_rb(recv, mid, arg, c_debug); end
|
20
|
+
|
21
|
+
# The method to fetch next token.
|
22
|
+
# If you use #do_parse method, you must implement #next_token.
|
23
|
+
#
|
24
|
+
# The format of return value is [TOKEN_SYMBOL, VALUE].
|
25
|
+
# +token-symbol+ is represented by Ruby's symbol by default, e.g. :IDENT
|
26
|
+
# for 'IDENT'. ";" (String) for ';'.
|
27
|
+
#
|
28
|
+
# The final symbol (End of file) must be false.
|
29
|
+
#
|
30
|
+
# @raise [NotImplementedError]
|
31
|
+
def next_token; end
|
32
|
+
|
33
|
+
# This method is called when a parse error is found.
|
34
|
+
#
|
35
|
+
# ERROR_TOKEN_ID is an internal ID of token which caused error.
|
36
|
+
# You can get string representation of this ID by calling
|
37
|
+
# #token_to_str.
|
38
|
+
#
|
39
|
+
# ERROR_VALUE is a value of error token.
|
40
|
+
#
|
41
|
+
# value_stack is a stack of symbol values.
|
42
|
+
# DO NOT MODIFY this object.
|
43
|
+
#
|
44
|
+
# This method raises ParseError by default.
|
45
|
+
#
|
46
|
+
# If this method returns, parsers enter "error recovering mode".
|
47
|
+
#
|
48
|
+
# @raise [ParseError]
|
49
|
+
def on_error(t, val, vstack); end
|
50
|
+
|
51
|
+
def racc_accept; end
|
52
|
+
def racc_e_pop(state, tstack, vstack); end
|
53
|
+
def racc_next_state(curstate, state); end
|
54
|
+
def racc_print_stacks(t, v); end
|
55
|
+
def racc_print_states(s); end
|
56
|
+
|
57
|
+
# For debugging output
|
58
|
+
def racc_read_token(t, tok, val); end
|
59
|
+
|
60
|
+
def racc_reduce(toks, sim, tstack, vstack); end
|
61
|
+
def racc_shift(tok, tstack, vstack); end
|
62
|
+
def racc_token2str(tok); end
|
63
|
+
|
64
|
+
# Convert internal ID of token symbol to the string.
|
65
|
+
def token_to_str(t); end
|
66
|
+
|
67
|
+
# Exit parser.
|
68
|
+
# Return value is +Symbol_Value_Stack[0]+.
|
69
|
+
def yyaccept; end
|
70
|
+
|
71
|
+
# Leave error recovering mode.
|
72
|
+
def yyerrok; end
|
73
|
+
|
74
|
+
# Enter error recovering mode.
|
75
|
+
# This method does not call #on_error.
|
76
|
+
def yyerror; end
|
77
|
+
|
78
|
+
class << self
|
79
|
+
def racc_runtime_type; end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
Racc::Parser::Racc_Main_Parsing_Routine = T.let(T.unsafe(nil), Symbol)
|
84
|
+
Racc::Parser::Racc_Runtime_Core_Id_C = T.let(T.unsafe(nil), String)
|
85
|
+
Racc::Parser::Racc_Runtime_Core_Version = T.let(T.unsafe(nil), String)
|
86
|
+
Racc::Parser::Racc_Runtime_Core_Version_C = T.let(T.unsafe(nil), String)
|
87
|
+
Racc::Parser::Racc_Runtime_Core_Version_R = T.let(T.unsafe(nil), String)
|
88
|
+
Racc::Parser::Racc_Runtime_Type = T.let(T.unsafe(nil), String)
|
89
|
+
Racc::Parser::Racc_Runtime_Version = T.let(T.unsafe(nil), String)
|
90
|
+
Racc::Parser::Racc_YY_Parse_Method = T.let(T.unsafe(nil), Symbol)
|
91
|
+
Racc::VERSION = T.let(T.unsafe(nil), String)
|
92
|
+
Racc::Version = T.let(T.unsafe(nil), String)
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `rails-dom-testing` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem rails-dom-testing`.
|
6
|
+
|
7
|
+
# THIS IS AN EMPTY RBI FILE.
|
8
|
+
# see https://github.com/Shopify/tapioca/wiki/Manual-Gem-Requires
|
@@ -0,0 +1,493 @@
|
|
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
|
+
module ActionView
|
8
|
+
extend ::ActiveSupport::Autoload
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def eager_load!; end
|
12
|
+
|
13
|
+
# Returns the currently loaded version of Action View as a <tt>Gem::Version</tt>.
|
14
|
+
def gem_version; end
|
15
|
+
|
16
|
+
# Returns the currently loaded version of Action View as a <tt>Gem::Version</tt>.
|
17
|
+
def version; end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
ActionView::ENCODING_FLAG = T.let(T.unsafe(nil), String)
|
22
|
+
|
23
|
+
# = Action View Debug Helper
|
24
|
+
#
|
25
|
+
# Provides a set of methods for making it easier to debug Rails objects.
|
26
|
+
module ActionView::Helpers
|
27
|
+
include ::ActiveSupport::Benchmarkable
|
28
|
+
include ::ActionView::Helpers::ActiveModelHelper
|
29
|
+
include ::ActionView::Helpers::AssetUrlHelper
|
30
|
+
include ::ActionView::Helpers::SanitizeHelper
|
31
|
+
include ::ActionView::Helpers::CaptureHelper
|
32
|
+
include ::ActionView::Helpers::OutputSafetyHelper
|
33
|
+
include ::ActionView::Helpers::TagHelper
|
34
|
+
include ::ActionView::Helpers::AssetTagHelper
|
35
|
+
include ::ActionView::Helpers::AtomFeedHelper
|
36
|
+
include ::ActionView::Helpers::CacheHelper
|
37
|
+
include ::ActionView::Helpers::ControllerHelper
|
38
|
+
include ::ActionView::Helpers::CspHelper
|
39
|
+
include ::ActionView::Helpers::CsrfHelper
|
40
|
+
include ::ActionView::Helpers::DateHelper
|
41
|
+
include ::ActionView::Helpers::DebugHelper
|
42
|
+
include ::ActionView::Helpers::TextHelper
|
43
|
+
include ::ActionView::Helpers::FormOptionsHelper
|
44
|
+
include ::ActionView::Helpers::JavaScriptHelper
|
45
|
+
include ::ActionView::Helpers::NumberHelper
|
46
|
+
include ::ActionView::Helpers::RenderingHelper
|
47
|
+
extend ::ActiveSupport::Autoload
|
48
|
+
extend ::ActiveSupport::Concern
|
49
|
+
include ::ActionView::Helpers::UrlHelper
|
50
|
+
include ::ActionView::Helpers::SanitizeHelper
|
51
|
+
include ::ActionView::Helpers::TextHelper
|
52
|
+
include ::ActionView::Helpers::FormTagHelper
|
53
|
+
include ::ActionView::Helpers::FormHelper
|
54
|
+
include ::ActionView::Helpers::TranslationHelper
|
55
|
+
|
56
|
+
mixes_in_class_methods ::ActionView::Helpers::UrlHelper::ClassMethods
|
57
|
+
mixes_in_class_methods ::ActionView::Helpers::SanitizeHelper::ClassMethods
|
58
|
+
|
59
|
+
class << self
|
60
|
+
def eager_load!; end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# The SanitizeHelper module provides a set of methods for scrubbing text of undesired HTML elements.
|
65
|
+
# These helper methods extend Action View making them callable within your template files.
|
66
|
+
module ActionView::Helpers::SanitizeHelper
|
67
|
+
extend ::ActiveSupport::Concern
|
68
|
+
|
69
|
+
mixes_in_class_methods ::ActionView::Helpers::SanitizeHelper::ClassMethods
|
70
|
+
|
71
|
+
# Sanitizes HTML input, stripping all but known-safe tags and attributes.
|
72
|
+
#
|
73
|
+
# It also strips href/src attributes with unsafe protocols like
|
74
|
+
# <tt>javascript:</tt>, while also protecting against attempts to use Unicode,
|
75
|
+
# ASCII, and hex character references to work around these protocol filters.
|
76
|
+
# All special characters will be escaped.
|
77
|
+
#
|
78
|
+
# The default sanitizer is Rails::Html::SafeListSanitizer. See {Rails HTML
|
79
|
+
# Sanitizers}[https://github.com/rails/rails-html-sanitizer] for more information.
|
80
|
+
#
|
81
|
+
# Custom sanitization rules can also be provided.
|
82
|
+
#
|
83
|
+
# Please note that sanitizing user-provided text does not guarantee that the
|
84
|
+
# resulting markup is valid or even well-formed.
|
85
|
+
#
|
86
|
+
# ==== Options
|
87
|
+
#
|
88
|
+
# * <tt>:tags</tt> - An array of allowed tags.
|
89
|
+
# * <tt>:attributes</tt> - An array of allowed attributes.
|
90
|
+
# * <tt>:scrubber</tt> - A {Rails::Html scrubber}[https://github.com/rails/rails-html-sanitizer]
|
91
|
+
# or {Loofah::Scrubber}[https://github.com/flavorjones/loofah] object that
|
92
|
+
# defines custom sanitization rules. A custom scrubber takes precedence over
|
93
|
+
# custom tags and attributes.
|
94
|
+
#
|
95
|
+
# ==== Examples
|
96
|
+
#
|
97
|
+
# Normal use:
|
98
|
+
#
|
99
|
+
# <%= sanitize @comment.body %>
|
100
|
+
#
|
101
|
+
# Providing custom lists of permitted tags and attributes:
|
102
|
+
#
|
103
|
+
# <%= sanitize @comment.body, tags: %w(strong em a), attributes: %w(href) %>
|
104
|
+
#
|
105
|
+
# Providing a custom Rails::Html scrubber:
|
106
|
+
#
|
107
|
+
# class CommentScrubber < Rails::Html::PermitScrubber
|
108
|
+
# def initialize
|
109
|
+
# super
|
110
|
+
# self.tags = %w( form script comment blockquote )
|
111
|
+
# self.attributes = %w( style )
|
112
|
+
# end
|
113
|
+
#
|
114
|
+
# def skip_node?(node)
|
115
|
+
# node.text?
|
116
|
+
# end
|
117
|
+
# end
|
118
|
+
#
|
119
|
+
# <%= sanitize @comment.body, scrubber: CommentScrubber.new %>
|
120
|
+
#
|
121
|
+
# See {Rails HTML Sanitizer}[https://github.com/rails/rails-html-sanitizer] for
|
122
|
+
# documentation about Rails::Html scrubbers.
|
123
|
+
#
|
124
|
+
# Providing a custom Loofah::Scrubber:
|
125
|
+
#
|
126
|
+
# scrubber = Loofah::Scrubber.new do |node|
|
127
|
+
# node.remove if node.name == 'script'
|
128
|
+
# end
|
129
|
+
#
|
130
|
+
# <%= sanitize @comment.body, scrubber: scrubber %>
|
131
|
+
#
|
132
|
+
# See {Loofah's documentation}[https://github.com/flavorjones/loofah] for more
|
133
|
+
# information about defining custom Loofah::Scrubber objects.
|
134
|
+
#
|
135
|
+
# To set the default allowed tags or attributes across your application:
|
136
|
+
#
|
137
|
+
# # In config/application.rb
|
138
|
+
# config.action_view.sanitized_allowed_tags = ['strong', 'em', 'a']
|
139
|
+
# config.action_view.sanitized_allowed_attributes = ['href', 'title']
|
140
|
+
def sanitize(html, options = T.unsafe(nil)); end
|
141
|
+
|
142
|
+
# Sanitizes a block of CSS code. Used by +sanitize+ when it comes across a style attribute.
|
143
|
+
def sanitize_css(style); end
|
144
|
+
|
145
|
+
# Strips all link tags from +html+ leaving just the link text.
|
146
|
+
#
|
147
|
+
# strip_links('<a href="http://www.rubyonrails.org">Ruby on Rails</a>')
|
148
|
+
# # => Ruby on Rails
|
149
|
+
#
|
150
|
+
# strip_links('Please e-mail me at <a href="mailto:me@email.com">me@email.com</a>.')
|
151
|
+
# # => Please e-mail me at me@email.com.
|
152
|
+
#
|
153
|
+
# strip_links('Blog: <a href="http://www.myblog.com/" class="nav" target=\"_blank\">Visit</a>.')
|
154
|
+
# # => Blog: Visit.
|
155
|
+
#
|
156
|
+
# strip_links('<<a href="https://example.org">malformed & link</a>')
|
157
|
+
# # => <malformed & link
|
158
|
+
def strip_links(html); end
|
159
|
+
|
160
|
+
# Strips all HTML tags from +html+, including comments and special characters.
|
161
|
+
#
|
162
|
+
# strip_tags("Strip <i>these</i> tags!")
|
163
|
+
# # => Strip these tags!
|
164
|
+
#
|
165
|
+
# strip_tags("<b>Bold</b> no more! <a href='more.html'>See more here</a>...")
|
166
|
+
# # => Bold no more! See more here...
|
167
|
+
#
|
168
|
+
# strip_tags("<div id='top-bar'>Welcome to my website!</div>")
|
169
|
+
# # => Welcome to my website!
|
170
|
+
#
|
171
|
+
# strip_tags("> A quote from Smith & Wesson")
|
172
|
+
# # => > A quote from Smith & Wesson
|
173
|
+
def strip_tags(html); end
|
174
|
+
end
|
175
|
+
|
176
|
+
module ActionView::Helpers::SanitizeHelper::ClassMethods
|
177
|
+
# Gets the Rails::Html::FullSanitizer instance used by +strip_tags+. Replace with
|
178
|
+
# any object that responds to +sanitize+.
|
179
|
+
#
|
180
|
+
# class Application < Rails::Application
|
181
|
+
# config.action_view.full_sanitizer = MySpecialSanitizer.new
|
182
|
+
# end
|
183
|
+
def full_sanitizer; end
|
184
|
+
|
185
|
+
# Sets the attribute full_sanitizer
|
186
|
+
#
|
187
|
+
# @param value the value to set the attribute full_sanitizer to.
|
188
|
+
def full_sanitizer=(_arg0); end
|
189
|
+
|
190
|
+
# Gets the Rails::Html::LinkSanitizer instance used by +strip_links+.
|
191
|
+
# Replace with any object that responds to +sanitize+.
|
192
|
+
#
|
193
|
+
# class Application < Rails::Application
|
194
|
+
# config.action_view.link_sanitizer = MySpecialSanitizer.new
|
195
|
+
# end
|
196
|
+
def link_sanitizer; end
|
197
|
+
|
198
|
+
# Sets the attribute link_sanitizer
|
199
|
+
#
|
200
|
+
# @param value the value to set the attribute link_sanitizer to.
|
201
|
+
def link_sanitizer=(_arg0); end
|
202
|
+
|
203
|
+
# Gets the Rails::Html::SafeListSanitizer instance used by sanitize and +sanitize_css+.
|
204
|
+
# Replace with any object that responds to +sanitize+.
|
205
|
+
#
|
206
|
+
# class Application < Rails::Application
|
207
|
+
# config.action_view.safe_list_sanitizer = MySpecialSanitizer.new
|
208
|
+
# end
|
209
|
+
def safe_list_sanitizer; end
|
210
|
+
|
211
|
+
# Sets the attribute safe_list_sanitizer
|
212
|
+
#
|
213
|
+
# @param value the value to set the attribute safe_list_sanitizer to.
|
214
|
+
def safe_list_sanitizer=(_arg0); end
|
215
|
+
|
216
|
+
def sanitized_allowed_attributes; end
|
217
|
+
|
218
|
+
# Replaces the allowed HTML attributes for the +sanitize+ helper.
|
219
|
+
#
|
220
|
+
# class Application < Rails::Application
|
221
|
+
# config.action_view.sanitized_allowed_attributes = ['onclick', 'longdesc']
|
222
|
+
# end
|
223
|
+
def sanitized_allowed_attributes=(attributes); end
|
224
|
+
|
225
|
+
def sanitized_allowed_css_keywords; end
|
226
|
+
def sanitized_allowed_css_keywords=(_); end
|
227
|
+
def sanitized_allowed_css_properties; end
|
228
|
+
def sanitized_allowed_css_properties=(_); end
|
229
|
+
def sanitized_allowed_protocols; end
|
230
|
+
def sanitized_allowed_protocols=(_); end
|
231
|
+
def sanitized_allowed_tags; end
|
232
|
+
|
233
|
+
# Replaces the allowed tags for the +sanitize+ helper.
|
234
|
+
#
|
235
|
+
# class Application < Rails::Application
|
236
|
+
# config.action_view.sanitized_allowed_tags = 'table', 'tr', 'td'
|
237
|
+
# end
|
238
|
+
def sanitized_allowed_tags=(tags); end
|
239
|
+
|
240
|
+
def sanitized_bad_tags; end
|
241
|
+
def sanitized_bad_tags=(_); end
|
242
|
+
def sanitized_protocol_separator; end
|
243
|
+
def sanitized_protocol_separator=(_); end
|
244
|
+
def sanitized_shorthand_css_properties; end
|
245
|
+
def sanitized_shorthand_css_properties=(_); end
|
246
|
+
def sanitized_uri_attributes; end
|
247
|
+
def sanitized_uri_attributes=(_); end
|
248
|
+
def sanitizer_vendor; end
|
249
|
+
|
250
|
+
private
|
251
|
+
|
252
|
+
def deprecate_option(name); end
|
253
|
+
end
|
254
|
+
|
255
|
+
ActionView::TemplateError = ActionView::Template::Error
|
256
|
+
module Rails; end
|
257
|
+
module Rails::Html; end
|
258
|
+
|
259
|
+
# === Rails::Html::FullSanitizer
|
260
|
+
# Removes all tags but strips out scripts, forms and comments.
|
261
|
+
#
|
262
|
+
# full_sanitizer = Rails::Html::FullSanitizer.new
|
263
|
+
# full_sanitizer.sanitize("<b>Bold</b> no more! <a href='more.html'>See more here</a>...")
|
264
|
+
# # => Bold no more! See more here...
|
265
|
+
class Rails::Html::FullSanitizer < ::Rails::Html::Sanitizer
|
266
|
+
def sanitize(html, options = T.unsafe(nil)); end
|
267
|
+
end
|
268
|
+
|
269
|
+
# === Rails::Html::LinkSanitizer
|
270
|
+
# Removes +a+ tags and +href+ attributes leaving only the link text.
|
271
|
+
#
|
272
|
+
# link_sanitizer = Rails::Html::LinkSanitizer.new
|
273
|
+
# link_sanitizer.sanitize('<a href="example.com">Only the link text will be kept.</a>')
|
274
|
+
#
|
275
|
+
# => 'Only the link text will be kept.'
|
276
|
+
class Rails::Html::LinkSanitizer < ::Rails::Html::Sanitizer
|
277
|
+
# @return [LinkSanitizer] a new instance of LinkSanitizer
|
278
|
+
def initialize; end
|
279
|
+
|
280
|
+
def sanitize(html, options = T.unsafe(nil)); end
|
281
|
+
end
|
282
|
+
|
283
|
+
# === Rails::Html::PermitScrubber
|
284
|
+
#
|
285
|
+
# +Rails::Html::PermitScrubber+ allows you to permit only your own tags and/or attributes.
|
286
|
+
#
|
287
|
+
# +Rails::Html::PermitScrubber+ can be subclassed to determine:
|
288
|
+
# - When a node should be skipped via +skip_node?+.
|
289
|
+
# - When a node is allowed via +allowed_node?+.
|
290
|
+
# - When an attribute should be scrubbed via +scrub_attribute?+.
|
291
|
+
#
|
292
|
+
# Subclasses don't need to worry if tags or attributes are set or not.
|
293
|
+
# If tags or attributes are not set, Loofah's behavior will be used.
|
294
|
+
# If you override +allowed_node?+ and no tags are set, it will not be called.
|
295
|
+
# Instead Loofahs behavior will be used.
|
296
|
+
# Likewise for +scrub_attribute?+ and attributes respectively.
|
297
|
+
#
|
298
|
+
# Text and CDATA nodes are skipped by default.
|
299
|
+
# Unallowed elements will be stripped, i.e. element is removed but its subtree kept.
|
300
|
+
# Supplied tags and attributes should be Enumerables.
|
301
|
+
#
|
302
|
+
# +tags=+
|
303
|
+
# If set, elements excluded will be stripped.
|
304
|
+
# If not, elements are stripped based on Loofahs +HTML5::Scrub.allowed_element?+.
|
305
|
+
#
|
306
|
+
# +attributes=+
|
307
|
+
# If set, attributes excluded will be removed.
|
308
|
+
# If not, attributes are removed based on Loofahs +HTML5::Scrub.scrub_attributes+.
|
309
|
+
#
|
310
|
+
# class CommentScrubber < Html::PermitScrubber
|
311
|
+
# def initialize
|
312
|
+
# super
|
313
|
+
# self.tags = %w(form script comment blockquote)
|
314
|
+
# end
|
315
|
+
#
|
316
|
+
# def skip_node?(node)
|
317
|
+
# node.text?
|
318
|
+
# end
|
319
|
+
#
|
320
|
+
# def scrub_attribute?(name)
|
321
|
+
# name == "style"
|
322
|
+
# end
|
323
|
+
# end
|
324
|
+
#
|
325
|
+
# See the documentation for +Nokogiri::XML::Node+ to understand what's possible
|
326
|
+
# with nodes: https://nokogiri.org/rdoc/Nokogiri/XML/Node.html
|
327
|
+
class Rails::Html::PermitScrubber < ::Loofah::Scrubber
|
328
|
+
# @return [PermitScrubber] a new instance of PermitScrubber
|
329
|
+
def initialize; end
|
330
|
+
|
331
|
+
# Returns the value of attribute attributes.
|
332
|
+
def attributes; end
|
333
|
+
|
334
|
+
def attributes=(attributes); end
|
335
|
+
def scrub(node); end
|
336
|
+
|
337
|
+
# Returns the value of attribute tags.
|
338
|
+
def tags; end
|
339
|
+
|
340
|
+
def tags=(tags); end
|
341
|
+
|
342
|
+
protected
|
343
|
+
|
344
|
+
# @return [Boolean]
|
345
|
+
def allowed_node?(node); end
|
346
|
+
|
347
|
+
# @return [Boolean]
|
348
|
+
def keep_node?(node); end
|
349
|
+
|
350
|
+
def scrub_attribute(node, attr_node); end
|
351
|
+
|
352
|
+
# @return [Boolean]
|
353
|
+
def scrub_attribute?(name); end
|
354
|
+
|
355
|
+
def scrub_attributes(node); end
|
356
|
+
def scrub_css_attribute(node); end
|
357
|
+
def scrub_node(node); end
|
358
|
+
|
359
|
+
# @return [Boolean]
|
360
|
+
def skip_node?(node); end
|
361
|
+
|
362
|
+
def validate!(var, name); end
|
363
|
+
end
|
364
|
+
|
365
|
+
# === Rails::Html::SafeListSanitizer
|
366
|
+
# Sanitizes html and css from an extensive safe list (see link further down).
|
367
|
+
#
|
368
|
+
# === Whitespace
|
369
|
+
# We can't make any guarantees about whitespace being kept or stripped.
|
370
|
+
# Loofah uses Nokogiri, which wraps either a C or Java parser for the
|
371
|
+
# respective Ruby implementation.
|
372
|
+
# Those two parsers determine how whitespace is ultimately handled.
|
373
|
+
#
|
374
|
+
# When the stripped markup will be rendered the users browser won't take
|
375
|
+
# whitespace into account anyway. It might be better to suggest your users
|
376
|
+
# wrap their whitespace sensitive content in pre tags or that you do
|
377
|
+
# so automatically.
|
378
|
+
#
|
379
|
+
# === Options
|
380
|
+
# Sanitizes both html and css via the safe lists found here:
|
381
|
+
# https://github.com/flavorjones/loofah/blob/master/lib/loofah/html5/safelist.rb
|
382
|
+
#
|
383
|
+
# SafeListSanitizer also accepts options to configure
|
384
|
+
# the safe list used when sanitizing html.
|
385
|
+
# There's a class level option:
|
386
|
+
# Rails::Html::SafeListSanitizer.allowed_tags = %w(table tr td)
|
387
|
+
# Rails::Html::SafeListSanitizer.allowed_attributes = %w(id class style)
|
388
|
+
#
|
389
|
+
# Tags and attributes can also be passed to +sanitize+.
|
390
|
+
# Passed options take precedence over the class level options.
|
391
|
+
#
|
392
|
+
# === Examples
|
393
|
+
# safe_list_sanitizer = Rails::Html::SafeListSanitizer.new
|
394
|
+
#
|
395
|
+
# Sanitize css doesn't take options
|
396
|
+
# safe_list_sanitizer.sanitize_css('background-color: #000;')
|
397
|
+
#
|
398
|
+
# Default: sanitize via a extensive safe list of allowed elements
|
399
|
+
# safe_list_sanitizer.sanitize(@article.body)
|
400
|
+
#
|
401
|
+
# Safe list via the supplied tags and attributes
|
402
|
+
# safe_list_sanitizer.sanitize(@article.body, tags: %w(table tr td),
|
403
|
+
# attributes: %w(id class style))
|
404
|
+
#
|
405
|
+
# Safe list via a custom scrubber
|
406
|
+
# safe_list_sanitizer.sanitize(@article.body, scrubber: ArticleScrubber.new)
|
407
|
+
class Rails::Html::SafeListSanitizer < ::Rails::Html::Sanitizer
|
408
|
+
# @return [SafeListSanitizer] a new instance of SafeListSanitizer
|
409
|
+
def initialize; end
|
410
|
+
|
411
|
+
def sanitize(html, options = T.unsafe(nil)); end
|
412
|
+
def sanitize_css(style_string); end
|
413
|
+
|
414
|
+
private
|
415
|
+
|
416
|
+
def allowed_attributes(options); end
|
417
|
+
def allowed_tags(options); end
|
418
|
+
|
419
|
+
# @return [Boolean]
|
420
|
+
def loofah_using_html5?; end
|
421
|
+
|
422
|
+
def remove_safelist_tag_combinations(tags); end
|
423
|
+
|
424
|
+
class << self
|
425
|
+
# Returns the value of attribute allowed_attributes.
|
426
|
+
def allowed_attributes; end
|
427
|
+
|
428
|
+
# Sets the attribute allowed_attributes
|
429
|
+
#
|
430
|
+
# @param value the value to set the attribute allowed_attributes to.
|
431
|
+
def allowed_attributes=(_arg0); end
|
432
|
+
|
433
|
+
# Returns the value of attribute allowed_tags.
|
434
|
+
def allowed_tags; end
|
435
|
+
|
436
|
+
# Sets the attribute allowed_tags
|
437
|
+
#
|
438
|
+
# @param value the value to set the attribute allowed_tags to.
|
439
|
+
def allowed_tags=(_arg0); end
|
440
|
+
end
|
441
|
+
end
|
442
|
+
|
443
|
+
class Rails::Html::Sanitizer
|
444
|
+
# @raise [NotImplementedError]
|
445
|
+
def sanitize(html, options = T.unsafe(nil)); end
|
446
|
+
|
447
|
+
private
|
448
|
+
|
449
|
+
def properly_encode(fragment, options); end
|
450
|
+
def remove_xpaths(node, xpaths); end
|
451
|
+
|
452
|
+
class << self
|
453
|
+
def full_sanitizer; end
|
454
|
+
def link_sanitizer; end
|
455
|
+
def safe_list_sanitizer; end
|
456
|
+
def white_list_sanitizer; end
|
457
|
+
end
|
458
|
+
end
|
459
|
+
|
460
|
+
Rails::Html::Sanitizer::VERSION = T.let(T.unsafe(nil), String)
|
461
|
+
|
462
|
+
# === Rails::Html::TargetScrubber
|
463
|
+
#
|
464
|
+
# Where +Rails::Html::PermitScrubber+ picks out tags and attributes to permit in
|
465
|
+
# sanitization, +Rails::Html::TargetScrubber+ targets them for removal.
|
466
|
+
#
|
467
|
+
# +tags=+
|
468
|
+
# If set, elements included will be stripped.
|
469
|
+
#
|
470
|
+
# +attributes=+
|
471
|
+
# If set, attributes included will be removed.
|
472
|
+
class Rails::Html::TargetScrubber < ::Rails::Html::PermitScrubber
|
473
|
+
# @return [Boolean]
|
474
|
+
def allowed_node?(node); end
|
475
|
+
|
476
|
+
# @return [Boolean]
|
477
|
+
def scrub_attribute?(name); end
|
478
|
+
end
|
479
|
+
|
480
|
+
# === Rails::Html::TextOnlyScrubber
|
481
|
+
#
|
482
|
+
# +Rails::Html::TextOnlyScrubber+ allows you to permit text nodes.
|
483
|
+
#
|
484
|
+
# Unallowed elements will be stripped, i.e. element is removed but its subtree kept.
|
485
|
+
class Rails::Html::TextOnlyScrubber < ::Loofah::Scrubber
|
486
|
+
# @return [TextOnlyScrubber] a new instance of TextOnlyScrubber
|
487
|
+
def initialize; end
|
488
|
+
|
489
|
+
def scrub(node); end
|
490
|
+
end
|
491
|
+
|
492
|
+
Rails::Html::WhiteListSanitizer = Rails::Html::SafeListSanitizer
|
493
|
+
Rails::Html::XPATHS_TO_REMOVE = T.let(T.unsafe(nil), Array)
|