actionpack 8.0.5 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2effaa8c37f91de6cda898c8ebb9857da735e8c2064c46473f4bd52caa70466c
4
- data.tar.gz: c42b8c6737bce6b429ea71f66a86fcdc7cd468887c110829b527296d253adbd5
3
+ metadata.gz: 5b2135f13807ec1b81f58b821d0110dbb0ffc66eff77788b8fcec4ae9a74cf0e
4
+ data.tar.gz: 8f6f0efcbe740bd97d66e1fd463ac31fc71a13602b5c3716619050be4dab0363
5
5
  SHA512:
6
- metadata.gz: 8b23a24307dd4d5ffb5d2ac31618809026d8b9620b27382a7b23d321648796b45f6e90d199117b4cc69b39db4d6558ad3dbef075ce5e5543043c57ae5f5cda25
7
- data.tar.gz: ace10e1524236d4cb72929262e3222c35a09a7abad52bc86b49abf979331261bdbd8860723afe96bc7e98e5a819b5cd62a1fd42f6ce7e31039b399facb61c409
6
+ metadata.gz: 7e382f4f372105c75eab3eb57e4bbc651eb75895b7f820f2a38bcdb5c1eef5ca2ea7291ac70751f843f2727956dce4b5f2ee875fc77e3f6356f645d411d49bb0
7
+ data.tar.gz: d27b6d307f70376ba5ad40a90a2e684203973c98e5bd9f975750a415aac7edd737d3a8e3c2f9af3b7d84a7528fbfb5aa4928cb606922b3d6d3d0c1f838533542
data/CHANGELOG.md CHANGED
@@ -1,3 +1,91 @@
1
+ ## Rails 8.0.5.2 (November 03, 2026) ##
2
+
3
+ * Apply `config.action_dispatch.cookies_same_site_protection` to every session
4
+ store.
5
+
6
+ `ActionDispatch::Session::CacheStore`, `MemCacheStore` and third-party
7
+ stores built on `AbstractStore` or the session mixins sent session cookies
8
+ with no `SameSite` attribute. Only `CookieStore` applied the configured
9
+ default.
10
+
11
+ [GHSA-gmj8-hvj3-49mw]
12
+
13
+ *Jean Boussier*
14
+
15
+ * Prevent `ActionController::Live` streams from blocking when a full buffer is
16
+ closed or aborted.
17
+
18
+ [GHSA-rwvh-fw6r-pwvp]
19
+
20
+ *Jeremy Daer*
21
+
22
+ * Set and extend the `Vary` header for rendered responses according to the
23
+ request headers used in format negotiation.
24
+
25
+ `Vary: Accept` was only added when the request carried a usable `Accept`
26
+ header. A response to a request without one, negotiated to HTML or
27
+ JavaScript, could be stored by a shared cache and served to later clients
28
+ that requested a different representation.
29
+
30
+ Responses now vary on `Accept` and `X-Requested-With` whenever the format is
31
+ not given by the URL. XHR requests without `Accept` also vary on
32
+ `Content-Type`, which Rails uses as a legacy format fallback. When
33
+ `config.action_dispatch.ignore_accept_header` is enabled, responses vary
34
+ only on `X-Requested-With`.
35
+
36
+ These fields are appended to an existing `Vary` value without duplicating
37
+ fields case-insensitively. `Vary: *` remains unchanged.
38
+
39
+ [GHSA-r9jg-fmfx-2gv6]
40
+
41
+ *Jeremy Daer*
42
+
43
+ * Skip writing a `CacheStore` session that another request deleted while this
44
+ one ran.
45
+
46
+ A request that loaded a session from `ActionDispatch::Session::CacheStore`
47
+ wrote it back when it finished, even after a concurrent `reset_session` or a
48
+ server-side delete had removed it, so the old session ID worked again.
49
+
50
+ [GHSA-2586-8ghr-69fj]
51
+
52
+ *Mike Dalessio*
53
+
54
+ * Don't write upgraded cookies to a response that skips the session.
55
+
56
+ Reading a signed or encrypted cookie written under a rotated secret, or in
57
+ the format a `:hybrid` serializer migrates from, writes it back in the
58
+ current format. That write ignored `request.session_options[:skip]`, so a
59
+ response that skips the session, such as the Active Storage proxy's
60
+ public, cacheable response, could still carry the session cookie in
61
+ `Set-Cookie`. Such a response now leaves the cookie unchanged, and a later
62
+ request that does not skip the session upgrades it. An application that
63
+ skips the session on every request no longer upgrades its signed or
64
+ encrypted cookies. Cookies the application sets are still written.
65
+
66
+ [GHSA-x6mj-8jx9-qhqv]
67
+
68
+ *Mike Dalessio*
69
+
70
+ * `ActionController::Parameters#each_key` returns `self` when given a block.
71
+
72
+ It returned the internal `ActiveSupport::HashWithIndifferentAccess`, which
73
+ does not respond to `permitted?`, so passing that return value to mass
74
+ assignment skipped the Strong Parameters check. `each`, `each_pair` and
75
+ `each_value` already return `self`.
76
+
77
+ Document that `ActionController::Parameters#as_json` returns every
78
+ parameter, permitted or not, in a hash that mass assignment does not check.
79
+
80
+ [GHSA-wm3x-v3qw-4jh3]
81
+
82
+ *Mike Dalessio*
83
+
84
+ ## Rails 8.0.5.1 (July 29, 2026) ##
85
+
86
+ * No changes.
87
+
88
+
1
89
  ## Rails 8.0.5 (March 24, 2026) ##
2
90
 
3
91
  * Add `config.action_controller.live_streaming_excluded_keys` to control execution state sharing in ActionController::Live.
@@ -218,7 +218,11 @@ module ActionController
218
218
  @response.delete_header "Content-Length"
219
219
  end
220
220
 
221
- super
221
+ begin
222
+ super
223
+ rescue ClosedQueueError
224
+ raise IOError, "closed stream" if connected?
225
+ end
222
226
 
223
227
  unless connected?
224
228
  @buf.clear
@@ -236,14 +240,14 @@ module ActionController
236
240
  write string.end_with?("\n") ? string : "#{string}\n"
237
241
  end
238
242
 
239
- # Write a 'close' event to the buffer; the producer/writing thread uses this to
240
- # notify us that it's finished supplying content.
243
+ # Close the buffer; the producer/writing thread uses this to notify us that
244
+ # it's finished supplying content.
241
245
  #
242
246
  # See also #abort.
243
247
  def close
244
248
  synchronize do
245
249
  super
246
- @buf.push nil
250
+ @buf.close
247
251
  @cv.broadcast
248
252
  end
249
253
  end
@@ -255,7 +259,9 @@ module ActionController
255
259
  def abort
256
260
  synchronize do
257
261
  @aborted = true
262
+ @buf.close
258
263
  @buf.clear
264
+ @cv.broadcast
259
265
  end
260
266
  end
261
267
 
@@ -218,8 +218,15 @@ module ActionController
218
218
  end
219
219
 
220
220
  def _set_vary_header
221
- if response.headers["Vary"].blank? && request.should_apply_vary_header?
222
- response.headers["Vary"] = "Accept"
221
+ if request.should_apply_vary_header?
222
+ vary_headers = response.headers["Vary"].to_s.split(",").map(&:strip).reject(&:blank?)
223
+
224
+ unless vary_headers.include?("*")
225
+ request.vary_headers.each do |header|
226
+ vary_headers << header unless vary_headers.any? { |existing| existing.casecmp?(header) }
227
+ end
228
+ response.headers["Vary"] = vary_headers.join(", ")
229
+ end
223
230
  end
224
231
  end
225
232
 
@@ -197,15 +197,14 @@ module ActionController
197
197
  # as_json(options=nil)
198
198
  #
199
199
  # Returns a hash that can be used as the JSON representation for the parameters.
200
-
201
- ##
202
- # :method: each_key
203
200
  #
204
- # :call-seq:
205
- # each_key(&block)
201
+ # Like `#to_unsafe_h`, the hash holds every parameter, permitted or not, and
202
+ # mass assignment does not check it. Do not pass it to a model.
206
203
  #
207
- # Calls block once for each key in the parameters, passing the key. If no block
208
- # is given, an enumerator is returned instead.
204
+ # params = ActionController::Parameters.new(name: "Bob", admin: true)
205
+ # params.as_json # => {"name" => "Bob", "admin" => true}
206
+ # User.new(params) # => ActiveModel::ForbiddenAttributesError
207
+ # User.new(params.as_json) # => #<User name: "Bob", admin: true>
209
208
 
210
209
  ##
211
210
  # :method: empty?
@@ -248,7 +247,7 @@ module ActionController
248
247
  # Returns the content of the parameters as a string.
249
248
 
250
249
  delegate :keys, :empty?, :exclude?, :include?,
251
- :as_json, :to_s, :each_key, to: :@parameters
250
+ :as_json, :to_s, to: :@parameters
252
251
 
253
252
  alias_method :has_key?, :include?
254
253
  alias_method :key?, :include?
@@ -420,6 +419,15 @@ module ActionController
420
419
  self
421
420
  end
422
421
 
422
+ # Calls block once for each key in the parameters, passing the key. If no block
423
+ # is given, an enumerator is returned instead.
424
+ def each_key(&block)
425
+ return to_enum(:each_key) unless block_given?
426
+ @parameters.each_key(&block)
427
+
428
+ self
429
+ end
430
+
423
431
  # Returns a new array of the values of the parameters.
424
432
  def values
425
433
  to_enum(:each_value).to_a
@@ -158,7 +158,17 @@ module ActionDispatch
158
158
  end
159
159
 
160
160
  def should_apply_vary_header?
161
- !params_readable? && use_accept_header && valid_accept_header
161
+ !params_readable?
162
+ end
163
+
164
+ def vary_headers # :nodoc:
165
+ if use_accept_header
166
+ headers = ["Accept", "X-Requested-With"]
167
+ headers.insert(1, "Content-Type") if xhr? && accept.blank?
168
+ headers
169
+ else
170
+ ["X-Requested-With"]
171
+ end
162
172
  end
163
173
 
164
174
  private
@@ -324,6 +324,7 @@ module ActionDispatch
324
324
  def initialize(request)
325
325
  @set_cookies = {}
326
326
  @delete_cookies = {}
327
+ @upgraded_cookies = Set.new
327
328
  @request = request
328
329
  @cookies = {}
329
330
  @committed = false
@@ -386,6 +387,7 @@ module ActionDispatch
386
387
  end
387
388
 
388
389
  handle_options(options)
390
+ @upgraded_cookies.delete(name.to_s)
389
391
 
390
392
  if @cookies[name.to_s] != value || options[:expires]
391
393
  @cookies[name.to_s] = value
@@ -426,8 +428,14 @@ module ActionDispatch
426
428
  @cookies.each_key { |k| delete(k, options) }
427
429
  end
428
430
 
431
+ def upgraded(name)
432
+ @upgraded_cookies << name.to_s
433
+ end
434
+
429
435
  def write(response)
430
436
  @set_cookies.each do |name, value|
437
+ next if @upgraded_cookies.include?(name) && request.session_options[:skip]
438
+
431
439
  if write_cookie?(value)
432
440
  response.set_cookie(name, value)
433
441
  end
@@ -533,6 +541,10 @@ module ActionDispatch
533
541
  @parent_jar[name] = options
534
542
  end
535
543
 
544
+ def upgraded(name)
545
+ @parent_jar.upgraded(name)
546
+ end
547
+
536
548
  protected
537
549
  def request; @parent_jar.request; end
538
550
 
@@ -599,7 +611,10 @@ module ActionDispatch
599
611
  return
600
612
  end
601
613
 
602
- self[name] = { value: value } if force_reserialize || reserialize?(dumped)
614
+ if force_reserialize || reserialize?(dumped)
615
+ self[name] = { value: value }
616
+ upgraded(name)
617
+ end
603
618
 
604
619
  value
605
620
  end
@@ -20,8 +20,13 @@ module ActionDispatch
20
20
  end
21
21
 
22
22
  module Compatibility
23
+ DEFAULT_SAME_SITE = proc { |request| request.cookies_same_site_protection } # :nodoc:
24
+
23
25
  def initialize(app, options = {})
24
26
  options[:key] ||= "_session_id"
27
+ unless options.key?(:same_site) || self.class::DEFAULT_OPTIONS.key?(:same_site)
28
+ options = options.merge(same_site: DEFAULT_SAME_SITE)
29
+ end
25
30
  super
26
31
  end
27
32
 
@@ -20,6 +20,8 @@ module ActionDispatch
20
20
  # is used.
21
21
  #
22
22
  class CacheStore < AbstractSecureStore
23
+ LOADED_SESSION_ID = "action_dispatch.session.cache_store.loaded_session_id" # :nodoc:
24
+
23
25
  def initialize(app, options = {})
24
26
  @cache = options[:cache] || Rails.cache
25
27
  options[:expire_after] ||= @cache.options[:expires_in]
@@ -27,17 +29,20 @@ module ActionDispatch
27
29
  end
28
30
 
29
31
  # Get a session from the cache.
30
- def find_session(env, sid)
31
- unless sid && (session = get_session_with_fallback(sid))
32
+ def find_session(req, sid)
33
+ if sid && (session = get_session_with_fallback(sid))
34
+ req.set_header(LOADED_SESSION_ID, sid.private_id)
35
+ else
32
36
  sid, session = generate_sid, {}
33
37
  end
34
38
  [sid, session]
35
39
  end
36
40
 
37
41
  # Set a session in the cache.
38
- def write_session(env, sid, session, options)
42
+ def write_session(req, sid, session, options)
39
43
  key = cache_key(sid.private_id)
40
44
  if session
45
+ return false if destroyed_since_loaded?(req, sid)
41
46
  @cache.write(key, session, expires_in: options[:expire_after])
42
47
  else
43
48
  @cache.delete(key)
@@ -61,6 +66,24 @@ module ActionDispatch
61
66
  def get_session_with_fallback(sid)
62
67
  @cache.read(cache_key(sid.private_id)) || @cache.read(cache_key(sid.public_id))
63
68
  end
69
+
70
+ # Writing back a session that another request deleted, such as on logout,
71
+ # would restore it.
72
+ def destroyed_since_loaded?(req, sid)
73
+ req.get_header(LOADED_SESSION_ID) == sid.private_id &&
74
+ !exist_in_backend?(cache_key(sid.private_id)) &&
75
+ !exist_in_backend?(cache_key(sid.public_id))
76
+ end
77
+
78
+ # The request-local cache still holds the entry this request loaded, so
79
+ # a lookup through it cannot see a delete made by another request.
80
+ def exist_in_backend?(key)
81
+ if @cache.respond_to?(:with_local_cache)
82
+ @cache.with_local_cache { @cache.exist?(key) }
83
+ else
84
+ @cache.exist?(key)
85
+ end
86
+ end
64
87
  end
65
88
  end
66
89
  end
@@ -59,11 +59,8 @@ module ActionDispatch
59
59
  end
60
60
  end
61
61
 
62
- DEFAULT_SAME_SITE = proc { |request| request.cookies_same_site_protection } # :nodoc:
63
-
64
62
  def initialize(app, options = {})
65
63
  options[:cookie_only] = true
66
- options[:same_site] = DEFAULT_SAME_SITE if !options.key?(:same_site)
67
64
  super
68
65
  end
69
66
 
@@ -12,7 +12,7 @@ module ActionPack
12
12
  MAJOR = 8
13
13
  MINOR = 0
14
14
  TINY = 5
15
- PRE = nil
15
+ PRE = "2"
16
16
 
17
17
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionpack
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: nokogiri
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -127,28 +127,28 @@ dependencies:
127
127
  requirements:
128
128
  - - '='
129
129
  - !ruby/object:Gem::Version
130
- version: 8.0.5
130
+ version: 8.0.5.2
131
131
  type: :runtime
132
132
  prerelease: false
133
133
  version_requirements: !ruby/object:Gem::Requirement
134
134
  requirements:
135
135
  - - '='
136
136
  - !ruby/object:Gem::Version
137
- version: 8.0.5
137
+ version: 8.0.5.2
138
138
  - !ruby/object:Gem::Dependency
139
139
  name: activemodel
140
140
  requirement: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - '='
143
143
  - !ruby/object:Gem::Version
144
- version: 8.0.5
144
+ version: 8.0.5.2
145
145
  type: :development
146
146
  prerelease: false
147
147
  version_requirements: !ruby/object:Gem::Requirement
148
148
  requirements:
149
149
  - - '='
150
150
  - !ruby/object:Gem::Version
151
- version: 8.0.5
151
+ version: 8.0.5.2
152
152
  description: Web apps on Rails. Simple, battle-tested conventions for building and
153
153
  testing MVC web applications. Works with any Rack-compatible server.
154
154
  email: david@loudthinking.com
@@ -349,10 +349,10 @@ licenses:
349
349
  - MIT
350
350
  metadata:
351
351
  bug_tracker_uri: https://github.com/rails/rails/issues
352
- changelog_uri: https://github.com/rails/rails/blob/v8.0.5/actionpack/CHANGELOG.md
353
- documentation_uri: https://api.rubyonrails.org/v8.0.5/
352
+ changelog_uri: https://github.com/rails/rails/blob/v8.0.5.2/actionpack/CHANGELOG.md
353
+ documentation_uri: https://api.rubyonrails.org/v8.0.5.2/
354
354
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
355
- source_code_uri: https://github.com/rails/rails/tree/v8.0.5/actionpack
355
+ source_code_uri: https://github.com/rails/rails/tree/v8.0.5.2/actionpack
356
356
  rubygems_mfa_required: 'true'
357
357
  rdoc_options: []
358
358
  require_paths:
@@ -369,7 +369,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
369
369
  version: '0'
370
370
  requirements:
371
371
  - none
372
- rubygems_version: 4.0.6
372
+ rubygems_version: 4.0.20
373
373
  specification_version: 4
374
374
  summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).
375
375
  test_files: []