actionpack 8.0.5.2 → 8.1.0.beta1
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 +231 -277
- data/lib/abstract_controller/asset_paths.rb +4 -2
- data/lib/abstract_controller/base.rb +10 -2
- data/lib/abstract_controller/caching.rb +6 -3
- data/lib/abstract_controller/helpers.rb +1 -1
- data/lib/abstract_controller/logger.rb +2 -1
- data/lib/action_controller/base.rb +1 -1
- data/lib/action_controller/caching.rb +1 -2
- data/lib/action_controller/form_builder.rb +1 -1
- data/lib/action_controller/log_subscriber.rb +7 -0
- data/lib/action_controller/metal/allow_browser.rb +1 -1
- data/lib/action_controller/metal/conditional_get.rb +25 -0
- data/lib/action_controller/metal/data_streaming.rb +1 -3
- data/lib/action_controller/metal/exceptions.rb +5 -0
- data/lib/action_controller/metal/flash.rb +1 -4
- data/lib/action_controller/metal/head.rb +3 -1
- data/lib/action_controller/metal/live.rb +5 -52
- data/lib/action_controller/metal/permissions_policy.rb +9 -0
- data/lib/action_controller/metal/rate_limiting.rb +22 -7
- data/lib/action_controller/metal/redirecting.rb +61 -5
- data/lib/action_controller/metal/renderers.rb +27 -6
- data/lib/action_controller/metal/rendering.rb +9 -10
- data/lib/action_controller/metal/request_forgery_protection.rb +18 -10
- data/lib/action_controller/metal/rescue.rb +9 -0
- data/lib/action_controller/metal/strong_parameters.rb +8 -16
- data/lib/action_controller/railtie.rb +2 -11
- data/lib/action_dispatch/http/cache.rb +111 -1
- data/lib/action_dispatch/http/filter_parameters.rb +5 -3
- data/lib/action_dispatch/http/mime_negotiation.rb +1 -11
- data/lib/action_dispatch/http/mime_types.rb +1 -0
- data/lib/action_dispatch/http/param_builder.rb +28 -27
- data/lib/action_dispatch/http/parameters.rb +3 -3
- data/lib/action_dispatch/http/permissions_policy.rb +4 -0
- data/lib/action_dispatch/http/query_parser.rb +12 -10
- data/lib/action_dispatch/http/request.rb +10 -5
- data/lib/action_dispatch/http/response.rb +16 -3
- data/lib/action_dispatch/http/url.rb +99 -3
- data/lib/action_dispatch/journey/gtg/simulator.rb +33 -12
- data/lib/action_dispatch/journey/gtg/transition_table.rb +33 -43
- data/lib/action_dispatch/journey/nodes/node.rb +2 -1
- data/lib/action_dispatch/journey/route.rb +45 -31
- data/lib/action_dispatch/journey/router/utils.rb +8 -14
- data/lib/action_dispatch/journey/router.rb +59 -81
- data/lib/action_dispatch/journey/routes.rb +7 -0
- data/lib/action_dispatch/journey/visitors.rb +55 -23
- data/lib/action_dispatch/journey/visualizer/fsm.js +4 -6
- data/lib/action_dispatch/middleware/cookies.rb +5 -18
- data/lib/action_dispatch/middleware/debug_exceptions.rb +8 -2
- data/lib/action_dispatch/middleware/debug_view.rb +11 -0
- data/lib/action_dispatch/middleware/exception_wrapper.rb +11 -5
- data/lib/action_dispatch/middleware/executor.rb +12 -2
- data/lib/action_dispatch/middleware/public_exceptions.rb +1 -5
- data/lib/action_dispatch/middleware/session/abstract_store.rb +0 -5
- data/lib/action_dispatch/middleware/session/cache_store.rb +16 -22
- data/lib/action_dispatch/middleware/session/cookie_store.rb +3 -0
- data/lib/action_dispatch/middleware/templates/rescues/_copy_button.html.erb +1 -0
- data/lib/action_dispatch/middleware/templates/rescues/_source.html.erb +3 -2
- data/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb +9 -5
- data/lib/action_dispatch/middleware/templates/rescues/blocked_host.html.erb +1 -0
- data/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb +1 -0
- data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb +1 -0
- data/lib/action_dispatch/middleware/templates/rescues/layout.erb +50 -0
- data/lib/action_dispatch/middleware/templates/rescues/missing_exact_template.html.erb +1 -0
- data/lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb +1 -0
- data/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb +1 -0
- data/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +1 -0
- data/lib/action_dispatch/middleware/templates/rescues/unknown_action.html.erb +1 -0
- data/lib/action_dispatch/railtie.rb +10 -2
- data/lib/action_dispatch/routing/inspector.rb +4 -1
- data/lib/action_dispatch/routing/mapper.rb +323 -173
- data/lib/action_dispatch/routing/route_set.rb +2 -4
- data/lib/action_dispatch/routing/routes_proxy.rb +0 -1
- data/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb +2 -2
- data/lib/action_dispatch/testing/assertions/response.rb +14 -0
- data/lib/action_dispatch/testing/assertions/routing.rb +11 -3
- data/lib/action_dispatch/testing/integration.rb +7 -7
- data/lib/action_dispatch/testing/request_encoder.rb +9 -9
- data/lib/action_pack/gem_version.rb +3 -3
- metadata +12 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ed45caa459109b7c6009c7b63f8be21dfe1965dc7bc745e8e7588579a9384391
|
|
4
|
+
data.tar.gz: aabc44311112b16f6e9b8c3f34f391d1fc1abe91cb1b0df7e920dd0068cbc8b0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 05dc45165c2451cf7a0bd23c7b5baf55ba3e970cde0877211b208f227b98e538237c373135f5d8c3ba905c18af5834d69086ab8e223a11f7d77fed3f0e067746
|
|
7
|
+
data.tar.gz: 43cba6f2e00ce49bc0b4ef8172eb26b6571325dcfa5c8b5deebcec90cfad8f6d8d7d0804459dc29e5fd36073aa8f1b09348999e6258197360be3306d9c41134e
|
data/CHANGELOG.md
CHANGED
|
@@ -1,156 +1,160 @@
|
|
|
1
|
-
## Rails 8.0.
|
|
1
|
+
## Rails 8.1.0.beta1 (September 04, 2025) ##
|
|
2
2
|
|
|
3
|
-
*
|
|
4
|
-
store.
|
|
3
|
+
* Remove deprecated support to a route to multiple paths.
|
|
5
4
|
|
|
6
|
-
|
|
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*
|
|
5
|
+
*Rafael Mendonça França*
|
|
14
6
|
|
|
15
|
-
*
|
|
16
|
-
closed or aborted.
|
|
7
|
+
* Remove deprecated support for using semicolons as a query string separator.
|
|
17
8
|
|
|
18
|
-
|
|
9
|
+
Before:
|
|
19
10
|
|
|
20
|
-
|
|
11
|
+
```ruby
|
|
12
|
+
ActionDispatch::QueryParser.each_pair("foo=bar;baz=quux").to_a
|
|
13
|
+
# => [["foo", "bar"], ["baz", "quux"]]
|
|
14
|
+
```
|
|
21
15
|
|
|
22
|
-
|
|
23
|
-
request headers used in format negotiation.
|
|
16
|
+
After:
|
|
24
17
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
```ruby
|
|
19
|
+
ActionDispatch::QueryParser.each_pair("foo=bar;baz=quux").to_a
|
|
20
|
+
# => [["foo", "bar;baz=quux"]]
|
|
21
|
+
```
|
|
29
22
|
|
|
30
|
-
|
|
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`.
|
|
23
|
+
*Rafael Mendonça França*
|
|
35
24
|
|
|
36
|
-
|
|
37
|
-
fields case-insensitively. `Vary: *` remains unchanged.
|
|
25
|
+
* Remove deprecated support to skipping over leading brackets in parameter names in the parameter parser.
|
|
38
26
|
|
|
39
|
-
|
|
27
|
+
Before:
|
|
40
28
|
|
|
41
|
-
|
|
29
|
+
```ruby
|
|
30
|
+
ActionDispatch::ParamBuilder.from_query_string("[foo]=bar") # => { "foo" => "bar" }
|
|
31
|
+
ActionDispatch::ParamBuilder.from_query_string("[foo][bar]=baz") # => { "foo" => { "bar" => "baz" } }
|
|
32
|
+
```
|
|
42
33
|
|
|
43
|
-
|
|
44
|
-
one ran.
|
|
34
|
+
After:
|
|
45
35
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
36
|
+
```ruby
|
|
37
|
+
ActionDispatch::ParamBuilder.from_query_string("[foo]=bar") # => { "[foo]" => "bar" }
|
|
38
|
+
ActionDispatch::ParamBuilder.from_query_string("[foo][bar]=baz") # => { "[foo]" => { "bar" => "baz" } }
|
|
39
|
+
```
|
|
49
40
|
|
|
50
|
-
|
|
41
|
+
*Rafael Mendonça França*
|
|
51
42
|
|
|
52
|
-
|
|
43
|
+
* Deprecate `Rails.application.config.action_dispatch.ignore_leading_brackets`.
|
|
53
44
|
|
|
54
|
-
*
|
|
45
|
+
*Rafael Mendonça França*
|
|
55
46
|
|
|
56
|
-
|
|
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.
|
|
47
|
+
* Raise `ActionController::TooManyRequests` error from `ActionController::RateLimiting`
|
|
65
48
|
|
|
66
|
-
|
|
49
|
+
Requests that exceed the rate limit raise an `ActionController::TooManyRequests` error.
|
|
50
|
+
By default, Action Dispatch rescues the error and responds with a `429 Too Many Requests` status.
|
|
67
51
|
|
|
68
|
-
*
|
|
52
|
+
*Sean Doyle*
|
|
69
53
|
|
|
70
|
-
*
|
|
54
|
+
* Add .md/.markdown as Markdown extensions and add a default `markdown:` renderer:
|
|
71
55
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
56
|
+
```ruby
|
|
57
|
+
class Page
|
|
58
|
+
def to_markdown
|
|
59
|
+
body
|
|
60
|
+
end
|
|
61
|
+
end
|
|
76
62
|
|
|
77
|
-
|
|
78
|
-
|
|
63
|
+
class PagesController < ActionController::Base
|
|
64
|
+
def show
|
|
65
|
+
@page = Page.find(params[:id])
|
|
79
66
|
|
|
80
|
-
|
|
67
|
+
respond_to do |format|
|
|
68
|
+
format.html
|
|
69
|
+
format.md { render markdown: @page }
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
```
|
|
81
74
|
|
|
82
|
-
*
|
|
75
|
+
*DHH*
|
|
83
76
|
|
|
84
|
-
|
|
77
|
+
* Add headers to engine routes inspection command
|
|
85
78
|
|
|
86
|
-
*
|
|
79
|
+
*Petrik de Heus*
|
|
87
80
|
|
|
81
|
+
* Add "Copy as text" button to error pages
|
|
88
82
|
|
|
89
|
-
|
|
83
|
+
*Mikkel Malmberg*
|
|
90
84
|
|
|
91
|
-
* Add `
|
|
85
|
+
* Add `scope:` option to `rate_limit` method.
|
|
92
86
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
state keys that should not be shared.
|
|
87
|
+
Previously, it was not possible to share a rate limit count between several controllers, since the count was by
|
|
88
|
+
default separate for each controller.
|
|
96
89
|
|
|
97
|
-
|
|
98
|
-
the streaming thread to use its own database connection context.
|
|
90
|
+
Now, the `scope:` option solves this problem.
|
|
99
91
|
|
|
100
92
|
```ruby
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
93
|
+
class APIController < ActionController::API
|
|
94
|
+
rate_limit to: 2, within: 2.seconds, scope: "api"
|
|
95
|
+
end
|
|
104
96
|
|
|
105
|
-
|
|
97
|
+
class API::PostsController < APIController
|
|
98
|
+
# ...
|
|
99
|
+
end
|
|
106
100
|
|
|
107
|
-
|
|
101
|
+
class API::UsersController < APIController
|
|
102
|
+
# ...
|
|
103
|
+
end
|
|
104
|
+
```
|
|
108
105
|
|
|
106
|
+
*ArthurPV*, *Kamil Hanus*
|
|
109
107
|
|
|
110
|
-
|
|
108
|
+
* Add support for `rack.response_finished` callbacks in ActionDispatch::Executor.
|
|
111
109
|
|
|
112
|
-
|
|
110
|
+
The executor middleware now supports deferring completion callbacks to later
|
|
111
|
+
in the request lifecycle by utilizing Rack's `rack.response_finished` mechanism,
|
|
112
|
+
when available. This enables applications to define `rack.response_finished` callbacks
|
|
113
|
+
that may rely on state that would be cleaned up by the executor's completion callbacks.
|
|
113
114
|
|
|
115
|
+
*Adrianna Chang*, *Hartley McGuire*
|
|
114
116
|
|
|
115
|
-
|
|
117
|
+
* Produce a log when `rescue_from` is invoked.
|
|
116
118
|
|
|
117
|
-
*
|
|
119
|
+
*Steven Webb*, *Jean Boussier*
|
|
118
120
|
|
|
119
|
-
|
|
121
|
+
* Allow hosts redirects from `hosts` Rails configuration
|
|
120
122
|
|
|
123
|
+
```ruby
|
|
124
|
+
config.action_controller.allowed_redirect_hosts << "example.com"
|
|
125
|
+
```
|
|
121
126
|
|
|
122
|
-
|
|
127
|
+
*Kevin Robatel*
|
|
123
128
|
|
|
124
|
-
*
|
|
129
|
+
* `rate_limit.action_controller` notification has additional payload
|
|
125
130
|
|
|
126
|
-
|
|
127
|
-
mounted at "/".
|
|
131
|
+
additional values: count, to, within, by, name, cache_key
|
|
128
132
|
|
|
129
|
-
*
|
|
133
|
+
*Jonathan Rochkind*
|
|
130
134
|
|
|
131
|
-
*
|
|
135
|
+
* Add JSON support to the built-in health controller.
|
|
132
136
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
This issue was only happening in development.
|
|
137
|
+
The health controller now responds to JSON requests with a structured response
|
|
138
|
+
containing status and timestamp information. This makes it easier for monitoring
|
|
139
|
+
tools and load balancers to consume health check data programmatically.
|
|
137
140
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
Please use :unprocessable_content instead.
|
|
141
|
+
```ruby
|
|
142
|
+
# /up.json
|
|
143
|
+
{
|
|
144
|
+
"status": "up",
|
|
145
|
+
"timestamp": "2025-09-19T12:00:00Z"
|
|
146
|
+
}
|
|
145
147
|
```
|
|
146
148
|
|
|
147
|
-
|
|
149
|
+
*Francesco Loreti*, *Juan Vásquez*
|
|
150
|
+
|
|
151
|
+
* Allow to open source file with a crash from the browser.
|
|
148
152
|
|
|
149
|
-
*
|
|
153
|
+
*Igor Kasyanchuk*
|
|
150
154
|
|
|
151
|
-
*
|
|
155
|
+
* Always check query string keys for valid encoding just like values are checked.
|
|
152
156
|
|
|
153
|
-
*
|
|
157
|
+
*Casper Smits*
|
|
154
158
|
|
|
155
159
|
* Always return empty body for HEAD requests in `PublicExceptions` and
|
|
156
160
|
`DebugExceptions`.
|
|
@@ -159,248 +163,198 @@
|
|
|
159
163
|
|
|
160
164
|
*Hartley McGuire*
|
|
161
165
|
|
|
166
|
+
* Add comprehensive support for HTTP Cache-Control request directives according to RFC 9111.
|
|
162
167
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
* No changes.
|
|
166
|
-
|
|
167
|
-
## Rails 8.0.2 (March 12, 2025) ##
|
|
168
|
-
|
|
169
|
-
* Improve `with_routing` test helper to not rebuild the middleware stack.
|
|
170
|
-
|
|
171
|
-
Otherwise some middleware configuration could be lost.
|
|
172
|
-
|
|
173
|
-
*Édouard Chin*
|
|
174
|
-
|
|
175
|
-
* Add resource name to the `ArgumentError` that's raised when invalid `:only` or `:except` options are given to `#resource` or `#resources`
|
|
176
|
-
|
|
177
|
-
This makes it easier to locate the source of the problem, especially for routes drawn by gems.
|
|
178
|
-
|
|
179
|
-
Before:
|
|
180
|
-
```
|
|
181
|
-
:only and :except must include only [:index, :create, :new, :show, :update, :destroy, :edit], but also included [:foo, :bar]
|
|
182
|
-
```
|
|
168
|
+
Provides a `request.cache_control_directives` object that gives access to request cache directives:
|
|
183
169
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
170
|
+
```ruby
|
|
171
|
+
# Boolean directives
|
|
172
|
+
request.cache_control_directives.only_if_cached? # => true/false
|
|
173
|
+
request.cache_control_directives.no_cache? # => true/false
|
|
174
|
+
request.cache_control_directives.no_store? # => true/false
|
|
175
|
+
request.cache_control_directives.no_transform? # => true/false
|
|
176
|
+
|
|
177
|
+
# Value directives
|
|
178
|
+
request.cache_control_directives.max_age # => integer or nil
|
|
179
|
+
request.cache_control_directives.max_stale # => integer or nil (or true for valueless max-stale)
|
|
180
|
+
request.cache_control_directives.min_fresh # => integer or nil
|
|
181
|
+
request.cache_control_directives.stale_if_error # => integer or nil
|
|
182
|
+
|
|
183
|
+
# Special helpers for max-stale
|
|
184
|
+
request.cache_control_directives.max_stale? # => true if max-stale present (with or without value)
|
|
185
|
+
request.cache_control_directives.max_stale_unlimited? # => true only for valueless max-stale
|
|
187
186
|
```
|
|
188
187
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
* Fix `url_for` to handle `:path_params` gracefully when it's not a `Hash`.
|
|
192
|
-
|
|
193
|
-
Prevents various security scanners from causing exceptions.
|
|
194
|
-
|
|
195
|
-
*Martin Emde*
|
|
196
|
-
|
|
197
|
-
* Fix `ActionDispatch::Executor` to unwrap exceptions like other error reporting middlewares.
|
|
198
|
-
|
|
199
|
-
*Jean Boussier*
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
## Rails 8.0.1 (December 13, 2024) ##
|
|
203
|
-
|
|
204
|
-
* Add `ActionDispatch::Request::Session#store` method to conform Rack spec.
|
|
205
|
-
|
|
206
|
-
*Yaroslav*
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
## Rails 8.0.0.1 (December 10, 2024) ##
|
|
210
|
-
|
|
211
|
-
* Add validation to content security policies to disallow spaces and semicolons.
|
|
212
|
-
Developers should use multiple arguments, and different directive methods instead.
|
|
188
|
+
Example usage:
|
|
213
189
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
190
|
+
```ruby
|
|
191
|
+
def show
|
|
192
|
+
if request.cache_control_directives.only_if_cached?
|
|
193
|
+
@article = Article.find_cached(params[:id])
|
|
194
|
+
return head(:gateway_timeout) if @article.nil?
|
|
195
|
+
else
|
|
196
|
+
@article = Article.find(params[:id])
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
render :show
|
|
200
|
+
end
|
|
201
|
+
```
|
|
225
202
|
|
|
226
|
-
*
|
|
203
|
+
*egg528*
|
|
227
204
|
|
|
228
|
-
|
|
205
|
+
* Add assert_in_body/assert_not_in_body as the simplest way to check if a piece of text is in the response body.
|
|
229
206
|
|
|
230
|
-
*
|
|
207
|
+
*DHH*
|
|
231
208
|
|
|
232
|
-
|
|
209
|
+
* Include cookie name when calculating maximum allowed size.
|
|
233
210
|
|
|
211
|
+
*Hartley McGuire*
|
|
234
212
|
|
|
235
|
-
|
|
213
|
+
* Implement `must-understand` directive according to RFC 9111.
|
|
236
214
|
|
|
237
|
-
|
|
215
|
+
The `must-understand` directive indicates that a cache must understand the semantics of the response status code, or discard the response. This directive is enforced to be used only with `no-store` to ensure proper cache behavior.
|
|
238
216
|
|
|
239
|
-
|
|
217
|
+
```ruby
|
|
218
|
+
class ArticlesController < ApplicationController
|
|
219
|
+
def show
|
|
220
|
+
@article = Article.find(params[:id])
|
|
221
|
+
|
|
222
|
+
if @article.special_format?
|
|
223
|
+
must_understand
|
|
224
|
+
render status: 203 # Non-Authoritative Information
|
|
225
|
+
else
|
|
226
|
+
fresh_when @article
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
```
|
|
240
231
|
|
|
241
|
-
*
|
|
232
|
+
*heka1024*
|
|
242
233
|
|
|
243
|
-
|
|
234
|
+
* The JSON renderer doesn't escape HTML entities or Unicode line separators anymore.
|
|
244
235
|
|
|
245
|
-
|
|
246
|
-
|
|
236
|
+
Using `render json:` will no longer escape `<`, `>`, `&`, `U+2028` and `U+2029` characters that can cause errors
|
|
237
|
+
when the resulting JSON is embedded in JavaScript, or vulnerabilities when the resulting JSON is embedded in HTML.
|
|
247
238
|
|
|
248
|
-
|
|
249
|
-
|
|
239
|
+
Since the renderer is used to return a JSON document as `application/json`, it's typically not necessary to escape
|
|
240
|
+
those characters, and it improves performance.
|
|
250
241
|
|
|
251
|
-
|
|
242
|
+
Escaping will still occur when the `:callback` option is set, since the JSON is used as JavaScript code in this
|
|
243
|
+
situation (JSONP).
|
|
252
244
|
|
|
253
|
-
|
|
245
|
+
You can use the `:escape` option or set `config.action_controller.escape_json_responses` to `true` to restore the
|
|
246
|
+
escaping behavior.
|
|
254
247
|
|
|
255
248
|
```ruby
|
|
256
|
-
class
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
def handle_outdated_browser
|
|
261
|
-
render file: Rails.root.join("public/custom-error.html"), status: :not_acceptable
|
|
262
|
-
end
|
|
249
|
+
class PostsController < ApplicationController
|
|
250
|
+
def index
|
|
251
|
+
render json: Post.last(30), escape: true
|
|
252
|
+
end
|
|
263
253
|
end
|
|
264
254
|
```
|
|
265
255
|
|
|
266
|
-
*
|
|
267
|
-
|
|
268
|
-
* Raise an `ArgumentError` when invalid `:only` or `:except` options are passed into `#resource` and `#resources`.
|
|
269
|
-
|
|
270
|
-
*Joshua Young*
|
|
271
|
-
|
|
272
|
-
## Rails 8.0.0.beta1 (September 26, 2024) ##
|
|
256
|
+
*Étienne Barrié*, *Jean Boussier*
|
|
273
257
|
|
|
274
|
-
*
|
|
258
|
+
* Load lazy route sets before inserting test routes
|
|
275
259
|
|
|
276
|
-
|
|
260
|
+
Without loading lazy route sets early, we miss `after_routes_loaded` callbacks, or risk
|
|
261
|
+
invoking them with the test routes instead of the real ones if another load is triggered by an engine.
|
|
277
262
|
|
|
278
|
-
*
|
|
279
|
-
|
|
280
|
-
*Adam Renberg Tamm*
|
|
263
|
+
*Gannon McGibbon*
|
|
281
264
|
|
|
282
|
-
*
|
|
283
|
-
`params.expect(table: [ :attr ])` replaces `params.require(:table).permit(:attr)`
|
|
265
|
+
* Raise `AbstractController::DoubleRenderError` if `head` is called after rendering.
|
|
284
266
|
|
|
285
|
-
|
|
286
|
-
types of values, improving handling of params and avoiding ignorable
|
|
287
|
-
errors caused by params tampering.
|
|
267
|
+
After this change, invoking `head` will lead to an error if response body is already set:
|
|
288
268
|
|
|
289
269
|
```ruby
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
params.expect(person: [ :name, :age, pets: [[:name]] ])
|
|
297
|
-
# raises ActionController::ParameterMissing, correctly returning a 400 error
|
|
270
|
+
class PostController < ApplicationController
|
|
271
|
+
def index
|
|
272
|
+
render locals: {}
|
|
273
|
+
head :ok
|
|
274
|
+
end
|
|
275
|
+
end
|
|
298
276
|
```
|
|
299
277
|
|
|
300
|
-
|
|
301
|
-
declare when a param is expected to be an array of parameter hashes,
|
|
302
|
-
this new double array syntax is used to explicitly declare an array.
|
|
303
|
-
`expect` requires you to declare expected arrays in this way, and will
|
|
304
|
-
ignore arrays that are passed when, for example, `pet: [:name]` is used.
|
|
305
|
-
|
|
306
|
-
In order to preserve compatibility, `permit` does not adopt the new
|
|
307
|
-
double array syntax and is therefore more permissive about unexpected
|
|
308
|
-
types. Using `expect` everywhere is recommended.
|
|
278
|
+
*Iaroslav Kurbatov*
|
|
309
279
|
|
|
310
|
-
|
|
311
|
-
with the direct replacement `params.expect(person: [:name, :age])`
|
|
312
|
-
to prevent external users from manipulating params to trigger 500
|
|
313
|
-
errors. A 400 error will be returned instead, using public/400.html
|
|
280
|
+
* The Cookie Serializer can now serialize an Active Support SafeBuffer when using message pack.
|
|
314
281
|
|
|
315
|
-
|
|
316
|
-
`params.expect(:id)` which is designed to ensure that `params[:id]`
|
|
317
|
-
is a scalar and not an array or hash, also requiring the param.
|
|
282
|
+
Such code would previously produce an error if an application was using messagepack as its cookie serializer.
|
|
318
283
|
|
|
319
284
|
```ruby
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
285
|
+
class PostController < ApplicationController
|
|
286
|
+
def index
|
|
287
|
+
flash.notice = t(:hello_html) # This would try to serialize a SafeBuffer, which was not possible.
|
|
288
|
+
end
|
|
289
|
+
end
|
|
325
290
|
```
|
|
326
291
|
|
|
327
|
-
*
|
|
328
|
-
|
|
329
|
-
* System Testing: Disable Chrome's search engine choice by default in system tests.
|
|
330
|
-
|
|
331
|
-
*glaszig*
|
|
332
|
-
|
|
333
|
-
* Fix `Request#raw_post` raising `NoMethodError` when `rack.input` is `nil`.
|
|
334
|
-
|
|
335
|
-
*Hartley McGuire*
|
|
336
|
-
|
|
337
|
-
* Remove `racc` dependency by manually writing `ActionDispatch::Journey::Scanner`.
|
|
338
|
-
|
|
339
|
-
*Gannon McGibbon*
|
|
292
|
+
*Edouard Chin*
|
|
340
293
|
|
|
341
|
-
*
|
|
294
|
+
* Fix `Rails.application.reload_routes!` from clearing almost all routes.
|
|
342
295
|
|
|
343
|
-
|
|
296
|
+
When calling `Rails.application.reload_routes!` inside a middleware of
|
|
297
|
+
a Rake task, it was possible under certain conditions that all routes would be cleared.
|
|
298
|
+
If ran inside a middleware, this would result in getting a 404 on most page you visit.
|
|
299
|
+
This issue was only happening in development.
|
|
344
300
|
|
|
345
|
-
*
|
|
301
|
+
*Edouard Chin*
|
|
346
302
|
|
|
347
|
-
|
|
303
|
+
* Add resource name to the `ArgumentError` that's raised when invalid `:only` or `:except` options are given to `#resource` or `#resources`
|
|
348
304
|
|
|
349
|
-
|
|
350
|
-
You may use `with_options` or a loop to make drawing multiple paths easier.
|
|
305
|
+
This makes it easier to locate the source of the problem, especially for routes drawn by gems.
|
|
351
306
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
307
|
+
Before:
|
|
308
|
+
```
|
|
309
|
+
:only and :except must include only [:index, :create, :new, :show, :update, :destroy, :edit], but also included [:foo, :bar]
|
|
310
|
+
```
|
|
355
311
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
312
|
+
After:
|
|
313
|
+
```
|
|
314
|
+
Route `resources :products` - :only and :except must include only [:index, :create, :new, :show, :update, :destroy, :edit], but also included [:foo, :bar]
|
|
359
315
|
```
|
|
360
316
|
|
|
361
|
-
*
|
|
317
|
+
*Jeremy Green*
|
|
362
318
|
|
|
363
|
-
*
|
|
319
|
+
* A route pointing to a non-existing controller now returns a 500 instead of a 404.
|
|
364
320
|
|
|
365
|
-
|
|
321
|
+
A controller not existing isn't a routing error that should result
|
|
322
|
+
in a 404, but a programming error that should result in a 500 and
|
|
323
|
+
be reported.
|
|
366
324
|
|
|
367
|
-
|
|
325
|
+
Until recently, this was hard to untangle because of the support
|
|
326
|
+
for dynamic `:controller` segment in routes, but since this is
|
|
327
|
+
deprecated and will be removed in Rails 8.1, we can now easily
|
|
328
|
+
not consider missing controllers as routing errors.
|
|
368
329
|
|
|
369
|
-
|
|
370
|
-
as specified by RFC 7232, Section 6.
|
|
330
|
+
*Jean Boussier*
|
|
371
331
|
|
|
372
|
-
|
|
373
|
-
Rails 8.0 defaults.
|
|
332
|
+
* Add `check_collisions` option to `ActionDispatch::Session::CacheStore`.
|
|
374
333
|
|
|
375
|
-
|
|
334
|
+
Newly generated session ids use 128 bits of randomness, which is more than
|
|
335
|
+
enough to ensure collisions can't happen, but if you need to harden sessions
|
|
336
|
+
even more, you can enable this option to check in the session store that the id
|
|
337
|
+
is indeed free you can enable that option. This however incurs an extra write
|
|
338
|
+
on session creation.
|
|
376
339
|
|
|
377
|
-
*
|
|
340
|
+
*Shia*
|
|
378
341
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
```
|
|
342
|
+
* In ExceptionWrapper, match backtrace lines with built templates more often,
|
|
343
|
+
allowing improved highlighting of errors within do-end blocks in templates.
|
|
344
|
+
Fix for Ruby 3.4 to match new method labels in backtrace.
|
|
383
345
|
|
|
384
|
-
*
|
|
346
|
+
*Martin Emde*
|
|
385
347
|
|
|
386
|
-
*
|
|
348
|
+
* Allow setting content type with a symbol of the Mime type.
|
|
387
349
|
|
|
388
350
|
```ruby
|
|
389
351
|
# Before
|
|
390
|
-
|
|
352
|
+
response.content_type = "text/html"
|
|
391
353
|
|
|
392
354
|
# After
|
|
393
|
-
|
|
355
|
+
response.content_type = :html
|
|
394
356
|
```
|
|
395
357
|
|
|
396
|
-
*
|
|
397
|
-
|
|
398
|
-
* Add `display_capture` and `keyboard_map` in `permissions_policy`
|
|
399
|
-
|
|
400
|
-
*Cyril Blaecke*
|
|
401
|
-
|
|
402
|
-
* Add `connect` route helper.
|
|
403
|
-
|
|
404
|
-
*Samuel Williams*
|
|
358
|
+
*Petrik de Heus*
|
|
405
359
|
|
|
406
|
-
Please check [
|
|
360
|
+
Please check [8-0-stable](https://github.com/rails/rails/blob/8-0-stable/actionpack/CHANGELOG.md) for previous changes.
|