actionview 6.0.4.7 → 6.0.5.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionview might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6a02c1e3b3bb79351d1ff2d6ff4e18ac281f735e3c3e9688a0ee980e59467881
4
- data.tar.gz: b01d9a6277d2cbc47f4ceeea6c31d4e4b867a44225ac1c28701c9ae1e2996e6d
3
+ metadata.gz: 7ae06527b9554d55d60951ace58d19621b78d4504a38d85f1611ee1a9159e6e8
4
+ data.tar.gz: 7739ec7a12cd620ea5334f5f730b875b1d1521e7c9983a4f22ad499840059164
5
5
  SHA512:
6
- metadata.gz: b1eb31601a70f6b6f70266e61f8279e354f746a62062ac03de88fb995ace71a8dc615bd10b2da0438758672a9efffd82d9d09ef2bfde54f546e21c977a5ce0fc
7
- data.tar.gz: a9be61ff408fcb1ed270af84aca45707017800b8a3ec9ff8b1e19e73c6d4d16e632c10749b9475f06ed410bac1c57c0c7a00f033a5a16c134c1cf028461d3aee
6
+ metadata.gz: b73a0f76f4aea630ef0cd80b18aaec8907842b351d3eca8a72ed256807774fe45af4ef71de6111f0fb7a655e36cd7a086de45d6f8f0ef4af7a63951f9e9eb748
7
+ data.tar.gz: 29e9ed9c4903f6d712e4b1a12d7e8f6c49d6bc4de6a9ae877605757f159ea20b72a1db3c60c528520102674bc3cf8e48d0a50dd88007cc4b67c423c1fb1caaa7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## Rails 6.0.5.1 (July 12, 2022) ##
2
+
3
+ * No changes.
4
+
5
+
6
+ ## Rails 6.0.5 (May 09, 2022) ##
7
+
8
+ * No changes.
9
+
10
+
11
+ ## Rails 6.0.4.8 (April 26, 2022) ##
12
+
13
+ * Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
14
+
15
+ Escape dangerous characters in names of tags and names of attributes in the
16
+ tag helpers, following the XML specification. Rename the option
17
+ `:escape_attributes` to `:escape`, to simplify by applying the option to the
18
+ whole tag.
19
+
20
+ *Álvaro Martín Fraguas*
21
+
22
+
1
23
  ## Rails 6.0.4.7 (March 08, 2022) ##
2
24
 
3
25
  * No changes.
@@ -152,7 +152,7 @@ module ActionView #:nodoc:
152
152
  # Specify whether rendering within namespaced controllers should prefix
153
153
  # the partial paths for ActiveModel objects with the namespace.
154
154
  # (e.g., an Admin::PostsController would render @post using /admin/posts/_post.erb)
155
- cattr_accessor :prefix_partial_path_with_controller_namespace, default: true
155
+ class_attribute :prefix_partial_path_with_controller_namespace, default: true
156
156
 
157
157
  # Specify default_formats that can be rendered.
158
158
  cattr_accessor :default_formats
@@ -9,8 +9,8 @@ module ActionView
9
9
  module VERSION
10
10
  MAJOR = 6
11
11
  MINOR = 0
12
- TINY = 4
13
- PRE = "7"
12
+ TINY = 5
13
+ PRE = "1"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -41,18 +41,25 @@ module ActionView
41
41
  @view_context = view_context
42
42
  end
43
43
 
44
- def tag_string(name, content = nil, escape_attributes: true, **options, &block)
44
+ def tag_string(name, content = nil, **options, &block)
45
+ escape = handle_deprecated_escape_options(options)
45
46
  content = @view_context.capture(self, &block) if block_given?
47
+
46
48
  if VOID_ELEMENTS.include?(name) && content.nil?
47
- "<#{name.to_s.dasherize}#{tag_options(options, escape_attributes)}>".html_safe
49
+ "<#{name.to_s.dasherize}#{tag_options(options, escape)}>".html_safe
48
50
  else
49
- content_tag_string(name.to_s.dasherize, content || "", options, escape_attributes)
51
+ content_tag_string(name.to_s.dasherize, content || "", options, escape)
50
52
  end
51
53
  end
52
54
 
53
55
  def content_tag_string(name, content, options, escape = true)
54
56
  tag_options = tag_options(options, escape) if options
55
- content = ERB::Util.unwrapped_html_escape(content) if escape
57
+
58
+ if escape
59
+ name = ERB::Util.xml_name_escape(name)
60
+ content = ERB::Util.unwrapped_html_escape(content)
61
+ end
62
+
56
63
  "<#{name}#{tag_options}>#{PRE_CONTENT_STRINGS[name]}#{content}</#{name}>".html_safe
57
64
  end
58
65
 
@@ -85,6 +92,8 @@ module ActionView
85
92
  end
86
93
 
87
94
  def tag_option(key, value, escape)
95
+ key = ERB::Util.xml_name_escape(key) if escape
96
+
88
97
  if value.is_a?(Array)
89
98
  value = escape ? safe_join(value, " ") : value.join(" ")
90
99
  else
@@ -107,6 +116,27 @@ module ActionView
107
116
  true
108
117
  end
109
118
 
119
+ def handle_deprecated_escape_options(options)
120
+ # The option :escape_attributes has been merged into the options hash to be
121
+ # able to warn when it is used, so we need to handle default values here.
122
+ escape_option_provided = options.has_key?(:escape)
123
+ escape_attributes_option_provided = options.has_key?(:escape_attributes)
124
+
125
+ if escape_attributes_option_provided
126
+ ActiveSupport::Deprecation.warn(<<~MSG)
127
+ Use of the option :escape_attributes is deprecated. It currently \
128
+ escapes both names and values of tags and attributes and it is \
129
+ equivalent to :escape. If any of them are enabled, the escaping \
130
+ is fully enabled.
131
+ MSG
132
+ end
133
+
134
+ return true unless escape_option_provided || escape_attributes_option_provided
135
+ escape_option = options.delete(:escape)
136
+ escape_attributes_option = options.delete(:escape_attributes)
137
+ escape_option || escape_attributes_option
138
+ end
139
+
110
140
  def method_missing(called, *args, **options, &block)
111
141
  tag_string(called, *args, **options, &block)
112
142
  end
@@ -237,6 +267,7 @@ module ActionView
237
267
  if name.nil?
238
268
  tag_builder
239
269
  else
270
+ name = ERB::Util.xml_name_escape(name) if escape
240
271
  "<#{name}#{tag_builder.tag_options(options, escape) if options}#{open ? ">" : " />"}".html_safe
241
272
  end
242
273
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionview
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.4.7
4
+ version: 6.0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-08 00:00:00.000000000 Z
11
+ date: 2022-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 6.0.4.7
19
+ version: 6.0.5.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 6.0.4.7
26
+ version: 6.0.5.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: builder
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -92,28 +92,28 @@ dependencies:
92
92
  requirements:
93
93
  - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: 6.0.4.7
95
+ version: 6.0.5.1
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - '='
101
101
  - !ruby/object:Gem::Version
102
- version: 6.0.4.7
102
+ version: 6.0.5.1
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: activemodel
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - '='
108
108
  - !ruby/object:Gem::Version
109
- version: 6.0.4.7
109
+ version: 6.0.5.1
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - '='
115
115
  - !ruby/object:Gem::Version
116
- version: 6.0.4.7
116
+ version: 6.0.5.1
117
117
  description: Simple, battle-tested conventions and helpers for building web pages.
118
118
  email: david@loudthinking.com
119
119
  executables: []
@@ -236,10 +236,11 @@ licenses:
236
236
  - MIT
237
237
  metadata:
238
238
  bug_tracker_uri: https://github.com/rails/rails/issues
239
- changelog_uri: https://github.com/rails/rails/blob/v6.0.4.7/actionview/CHANGELOG.md
240
- documentation_uri: https://api.rubyonrails.org/v6.0.4.7/
239
+ changelog_uri: https://github.com/rails/rails/blob/v6.0.5.1/actionview/CHANGELOG.md
240
+ documentation_uri: https://api.rubyonrails.org/v6.0.5.1/
241
241
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
242
- source_code_uri: https://github.com/rails/rails/tree/v6.0.4.7/actionview
242
+ source_code_uri: https://github.com/rails/rails/tree/v6.0.5.1/actionview
243
+ rubygems_mfa_required: 'true'
243
244
  post_install_message:
244
245
  rdoc_options: []
245
246
  require_paths:
@@ -256,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
256
257
  version: '0'
257
258
  requirements:
258
259
  - none
259
- rubygems_version: 3.1.6
260
+ rubygems_version: 3.3.3
260
261
  signing_key:
261
262
  specification_version: 4
262
263
  summary: Rendering framework putting the V in MVC (part of Rails).