actionview 8.0.5.1 → 8.0.5.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +56 -0
- data/lib/action_view/gem_version.rb +1 -1
- data/lib/action_view/helpers/sanitize_helper.rb +6 -1
- data/lib/action_view/helpers/tag_helper.rb +13 -4
- data/lib/action_view/helpers/text_helper.rb +23 -7
- metadata +17 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9e3471ef52672292ca9950c0497300061713104fb75abdef2eaa69c392dce1e3
|
|
4
|
+
data.tar.gz: 1d2084723d63c509f943eb60763e877fa0f3a0ef4926142ffdda8f40fae7b05a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9ba7329d06db4fc19fbd97773acbe78a9355a8d6977067d7a4d08c088eaa39d35c8574ebedce3b83955583fd82d6694b503b2383ab870dfd3504506ea2b88bfb
|
|
7
|
+
data.tar.gz: 27c64c7e736a6ce282011a1e61230856d40a191fb7cce7f6a3095570ad9c309c6b25dbfc5241156ea9214f063f5d5da16eeae2e8e62f1f673365df6db5af7683
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,59 @@
|
|
|
1
|
+
## Rails 8.0.5.2 (November 03, 2026) ##
|
|
2
|
+
|
|
3
|
+
* Skip attribute names in tag helpers that are blank once converted to a
|
|
4
|
+
string.
|
|
5
|
+
|
|
6
|
+
A Symbol such as `:" "` is not blank, because `Symbol#blank?` is
|
|
7
|
+
`Symbol#empty?`, so it reached the escaping step and produced an attribute
|
|
8
|
+
with no name. The asset helpers symbolize their keys, so an ordinary String
|
|
9
|
+
key reached the same place.
|
|
10
|
+
|
|
11
|
+
[GHSA-68p9-83h6-5wpj]
|
|
12
|
+
|
|
13
|
+
*Mike Dalessio*
|
|
14
|
+
|
|
15
|
+
* Fix `strip_tags` to encode `"` and `'` in its output.
|
|
16
|
+
|
|
17
|
+
`strip_tags` returns an `html_safe` string, but was not encoding quotation
|
|
18
|
+
marks. The method now encodes all five HTML-significant characters (`&`,
|
|
19
|
+
`<`, `>`, `"`, `'`), consistent with the existing `html_safe` convention.
|
|
20
|
+
|
|
21
|
+
Output used outside HTML, such as in a text template or JSON, now contains
|
|
22
|
+
`"` and `'` where it contained `"` and `'`. `CGI.unescapeHTML`
|
|
23
|
+
decodes them.
|
|
24
|
+
|
|
25
|
+
[GHSA-rq8q-p985-fjq7]
|
|
26
|
+
|
|
27
|
+
*Mike Dalessio*
|
|
28
|
+
|
|
29
|
+
* Escape the matched phrase before substituting it into `highlight`'s
|
|
30
|
+
`:highlighter`.
|
|
31
|
+
|
|
32
|
+
A match was copied into each `\1` of the highlighter as it appeared in
|
|
33
|
+
the sanitized text, which keeps `"` and `'` as they are, so a match
|
|
34
|
+
containing a quote ended a quoted attribute value such as the
|
|
35
|
+
documented `'<a href="search?q=\1">\1</a>'` and added attributes of
|
|
36
|
+
its own. Each substituted group now goes through
|
|
37
|
+
`ERB::Util.html_escape_once`, so quotes in a match render as `"`
|
|
38
|
+
and `'`. Only the numbered placeholders `\0` to `\9` are expanded,
|
|
39
|
+
and a match never replaces the `>` that closes a tag.
|
|
40
|
+
|
|
41
|
+
[GHSA-v6rj-xm57-3p59]
|
|
42
|
+
|
|
43
|
+
*Jeremy Daer*
|
|
44
|
+
|
|
45
|
+
* Require rails-html-sanitizer 1.7.2 or later.
|
|
46
|
+
|
|
47
|
+
With the HTML5 sanitizer, Nokogiri before 1.19.5 left `<` and `>`
|
|
48
|
+
unescaped in attribute values. `highlight` and `simple_format`, which
|
|
49
|
+
edit the sanitized HTML as a string, could then turn markup inside an
|
|
50
|
+
attribute value into live elements. rails-html-sanitizer 1.7.2 requires
|
|
51
|
+
Loofah 2.25.3, which requires Nokogiri 1.19.5.
|
|
52
|
+
|
|
53
|
+
[GHSA-2p2f-4rq4-gjwc]
|
|
54
|
+
|
|
55
|
+
*Mike Dalessio*
|
|
56
|
+
|
|
1
57
|
## Rails 8.0.5.1 (July 29, 2026) ##
|
|
2
58
|
|
|
3
59
|
* No changes.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "active_support/core_ext/string/output_safety"
|
|
3
4
|
require "rails-html-sanitizer"
|
|
4
5
|
|
|
5
6
|
module ActionView
|
|
@@ -33,6 +34,9 @@ module ActionView
|
|
|
33
34
|
# Please note that sanitizing user-provided text does not guarantee that the
|
|
34
35
|
# resulting markup is valid or even well-formed.
|
|
35
36
|
#
|
|
37
|
+
# The output is markup, which is safe only as element content. Do not use it in an attribute
|
|
38
|
+
# value; use +strip_tags+ or a tag helper such as <tt>tag.a(title: ...)</tt> instead.
|
|
39
|
+
#
|
|
36
40
|
# ==== Options
|
|
37
41
|
#
|
|
38
42
|
# [+:tags+]
|
|
@@ -137,7 +141,8 @@ module ActionView
|
|
|
137
141
|
# strip_tags("> A quote from Smith & Wesson")
|
|
138
142
|
# # => > A quote from Smith & Wesson
|
|
139
143
|
def strip_tags(html)
|
|
140
|
-
self.class.full_sanitizer.sanitize(html)
|
|
144
|
+
stripped = self.class.full_sanitizer.sanitize(html)
|
|
145
|
+
ERB::Util.html_escape_once(stripped) if stripped
|
|
141
146
|
end
|
|
142
147
|
|
|
143
148
|
# Strips all link tags from +html+ leaving just the link text.
|
|
@@ -252,18 +252,27 @@ module ActionView
|
|
|
252
252
|
options.each_pair do |key, value|
|
|
253
253
|
next if key.blank?
|
|
254
254
|
|
|
255
|
+
name = Symbol === key ? key.name : key.to_s
|
|
256
|
+
next if name.blank?
|
|
257
|
+
|
|
255
258
|
type = TAG_TYPES[key]
|
|
256
259
|
if type == :data && value.is_a?(Hash)
|
|
257
260
|
value.each_pair do |k, v|
|
|
258
261
|
next if k.blank? || v.nil?
|
|
259
262
|
|
|
263
|
+
nested_name = Symbol === k ? k.name : k.to_s
|
|
264
|
+
next if nested_name.blank?
|
|
265
|
+
|
|
260
266
|
output << sep
|
|
261
|
-
output << prefix_tag_option(
|
|
267
|
+
output << prefix_tag_option(name, nested_name, v, escape)
|
|
262
268
|
end
|
|
263
269
|
elsif type == :aria && value.is_a?(Hash)
|
|
264
270
|
value.each_pair do |k, v|
|
|
265
271
|
next if k.blank? || v.nil?
|
|
266
272
|
|
|
273
|
+
nested_name = Symbol === k ? k.name : k.to_s
|
|
274
|
+
next if nested_name.blank?
|
|
275
|
+
|
|
267
276
|
case v
|
|
268
277
|
when Array, Hash
|
|
269
278
|
tokens = TagHelper.build_tag_values(v)
|
|
@@ -275,16 +284,16 @@ module ActionView
|
|
|
275
284
|
end
|
|
276
285
|
|
|
277
286
|
output << sep
|
|
278
|
-
output << prefix_tag_option(
|
|
287
|
+
output << prefix_tag_option(name, nested_name, v, escape)
|
|
279
288
|
end
|
|
280
289
|
elsif type == :boolean
|
|
281
290
|
if value
|
|
282
291
|
output << sep
|
|
283
|
-
output << boolean_tag_option(
|
|
292
|
+
output << boolean_tag_option(name)
|
|
284
293
|
end
|
|
285
294
|
elsif !value.nil?
|
|
286
295
|
output << sep
|
|
287
|
-
output << tag_option(
|
|
296
|
+
output << tag_option(name, value, escape)
|
|
288
297
|
end
|
|
289
298
|
end
|
|
290
299
|
output unless output.empty?
|
|
@@ -143,8 +143,15 @@ module ActionView
|
|
|
143
143
|
#
|
|
144
144
|
# [+:highlighter+]
|
|
145
145
|
# The highlighter string. Uses <tt>\1</tt> as the placeholder for a
|
|
146
|
-
# phrase
|
|
147
|
-
#
|
|
146
|
+
# phrase. Defaults to <tt>"<mark>\1</mark>"</tt>. The numbered placeholders
|
|
147
|
+
# <tt>\0</tt> to <tt>\9</tt> are expanded; other +String#sub+ replacement escapes
|
|
148
|
+
# are not. The phrase is HTML escaped, quotes included. This option
|
|
149
|
+
# is ignored if a block is specified.
|
|
150
|
+
#
|
|
151
|
+
# WARNING: Put a placeholder only in element content or inside a
|
|
152
|
+
# quoted attribute value. HTML escaping does not make the phrase safe
|
|
153
|
+
# in an unquoted attribute value, in a URL, JavaScript or CSS
|
|
154
|
+
# context, or in an attribute whose value is HTML, such as +srcdoc+.
|
|
148
155
|
#
|
|
149
156
|
# [+:sanitize+]
|
|
150
157
|
# Whether to sanitize +text+ before highlighting. Defaults to true.
|
|
@@ -163,8 +170,8 @@ module ActionView
|
|
|
163
170
|
# highlight('You searched for: rails', ['for', 'rails'], highlighter: '<em>\1</em>')
|
|
164
171
|
# # => "You searched <em>for</em>: <em>rails</em>"
|
|
165
172
|
#
|
|
166
|
-
# highlight('You searched for: rails', 'rails', highlighter: '<
|
|
167
|
-
# # => "You searched for: <
|
|
173
|
+
# highlight('You searched for: rails', 'rails', highlighter: '<mark title="\1">\1</mark>')
|
|
174
|
+
# # => "You searched for: <mark title=\"rails\">rails</mark>"
|
|
168
175
|
#
|
|
169
176
|
# highlight('You searched for: rails', 'rails') { |match| link_to(search_path(q: match)) }
|
|
170
177
|
# # => "You searched for: <a href=\"search?q=rails\">rails</a>"
|
|
@@ -179,14 +186,23 @@ module ActionView
|
|
|
179
186
|
else
|
|
180
187
|
patterns = Array(phrases).map { |phrase| Regexp === phrase ? phrase : Regexp.escape(phrase) }
|
|
181
188
|
pattern = /(#{patterns.join("|")})/i
|
|
189
|
+
# The text after a tag begins with the ">" that closes it. Leave it
|
|
190
|
+
# in the segment so phrases can see it as context, but keep it out
|
|
191
|
+
# of the match so the highlighter can't take the place of the ">".
|
|
192
|
+
pattern_after_tag = /(?!\A)#{pattern}/
|
|
182
193
|
highlighter = options.fetch(:highlighter, '<mark>\1</mark>') unless block
|
|
183
194
|
|
|
184
|
-
text.scan(/<[^>]*|[^<]+/).
|
|
195
|
+
text.scan(/<[^>]*|[^<]+/).each_with_index do |segment, index|
|
|
185
196
|
if !segment.start_with?("<")
|
|
197
|
+
segment_pattern = index > 0 ? pattern_after_tag : pattern
|
|
198
|
+
|
|
186
199
|
if block
|
|
187
|
-
segment.gsub!(
|
|
200
|
+
segment.gsub!(segment_pattern, &block)
|
|
188
201
|
else
|
|
189
|
-
segment.gsub!(
|
|
202
|
+
segment.gsub!(segment_pattern) do
|
|
203
|
+
match = Regexp.last_match
|
|
204
|
+
highlighter.gsub(/\\(\d)/) { ERB::Util.html_escape_once(match[$1.to_i]) }
|
|
205
|
+
end
|
|
190
206
|
end
|
|
191
207
|
end
|
|
192
208
|
end.join
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: actionview
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 8.0.5.
|
|
4
|
+
version: 8.0.5.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Heinemeier Hansson
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 8.0.5.
|
|
18
|
+
version: 8.0.5.2
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 8.0.5.
|
|
25
|
+
version: 8.0.5.2
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: builder
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -58,6 +58,9 @@ dependencies:
|
|
|
58
58
|
- - "~>"
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
60
|
version: '1.6'
|
|
61
|
+
- - ">="
|
|
62
|
+
- !ruby/object:Gem::Version
|
|
63
|
+
version: 1.7.2
|
|
61
64
|
type: :runtime
|
|
62
65
|
prerelease: false
|
|
63
66
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -65,6 +68,9 @@ dependencies:
|
|
|
65
68
|
- - "~>"
|
|
66
69
|
- !ruby/object:Gem::Version
|
|
67
70
|
version: '1.6'
|
|
71
|
+
- - ">="
|
|
72
|
+
- !ruby/object:Gem::Version
|
|
73
|
+
version: 1.7.2
|
|
68
74
|
- !ruby/object:Gem::Dependency
|
|
69
75
|
name: rails-dom-testing
|
|
70
76
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -85,28 +91,28 @@ dependencies:
|
|
|
85
91
|
requirements:
|
|
86
92
|
- - '='
|
|
87
93
|
- !ruby/object:Gem::Version
|
|
88
|
-
version: 8.0.5.
|
|
94
|
+
version: 8.0.5.2
|
|
89
95
|
type: :development
|
|
90
96
|
prerelease: false
|
|
91
97
|
version_requirements: !ruby/object:Gem::Requirement
|
|
92
98
|
requirements:
|
|
93
99
|
- - '='
|
|
94
100
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: 8.0.5.
|
|
101
|
+
version: 8.0.5.2
|
|
96
102
|
- !ruby/object:Gem::Dependency
|
|
97
103
|
name: activemodel
|
|
98
104
|
requirement: !ruby/object:Gem::Requirement
|
|
99
105
|
requirements:
|
|
100
106
|
- - '='
|
|
101
107
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: 8.0.5.
|
|
108
|
+
version: 8.0.5.2
|
|
103
109
|
type: :development
|
|
104
110
|
prerelease: false
|
|
105
111
|
version_requirements: !ruby/object:Gem::Requirement
|
|
106
112
|
requirements:
|
|
107
113
|
- - '='
|
|
108
114
|
- !ruby/object:Gem::Version
|
|
109
|
-
version: 8.0.5.
|
|
115
|
+
version: 8.0.5.2
|
|
110
116
|
description: Simple, battle-tested conventions and helpers for building web pages.
|
|
111
117
|
email: david@loudthinking.com
|
|
112
118
|
executables: []
|
|
@@ -246,10 +252,10 @@ licenses:
|
|
|
246
252
|
- MIT
|
|
247
253
|
metadata:
|
|
248
254
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
|
249
|
-
changelog_uri: https://github.com/rails/rails/blob/v8.0.5.
|
|
250
|
-
documentation_uri: https://api.rubyonrails.org/v8.0.5.
|
|
255
|
+
changelog_uri: https://github.com/rails/rails/blob/v8.0.5.2/actionview/CHANGELOG.md
|
|
256
|
+
documentation_uri: https://api.rubyonrails.org/v8.0.5.2/
|
|
251
257
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
|
252
|
-
source_code_uri: https://github.com/rails/rails/tree/v8.0.5.
|
|
258
|
+
source_code_uri: https://github.com/rails/rails/tree/v8.0.5.2/actionview
|
|
253
259
|
rubygems_mfa_required: 'true'
|
|
254
260
|
rdoc_options: []
|
|
255
261
|
require_paths:
|
|
@@ -266,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
266
272
|
version: '0'
|
|
267
273
|
requirements:
|
|
268
274
|
- none
|
|
269
|
-
rubygems_version: 4.0.
|
|
275
|
+
rubygems_version: 4.0.20
|
|
270
276
|
specification_version: 4
|
|
271
277
|
summary: Rendering framework putting the V in MVC (part of Rails).
|
|
272
278
|
test_files: []
|