actionpack 5.2.1 → 7.0.2.4

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

Potentially problematic release.


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

Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +264 -220
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +6 -6
  5. data/lib/abstract_controller/asset_paths.rb +1 -1
  6. data/lib/abstract_controller/base.rb +24 -4
  7. data/lib/abstract_controller/caching/fragments.rb +8 -24
  8. data/lib/abstract_controller/caching.rb +2 -2
  9. data/lib/abstract_controller/callbacks.rb +34 -8
  10. data/lib/abstract_controller/collector.rb +5 -4
  11. data/lib/abstract_controller/error.rb +1 -1
  12. data/lib/abstract_controller/helpers.rb +107 -90
  13. data/lib/abstract_controller/logger.rb +1 -1
  14. data/lib/abstract_controller/railties/routes_helpers.rb +19 -1
  15. data/lib/abstract_controller/rendering.rb +9 -9
  16. data/lib/abstract_controller/translation.rb +12 -5
  17. data/lib/abstract_controller/url_for.rb +4 -6
  18. data/lib/abstract_controller.rb +2 -0
  19. data/lib/action_controller/api.rb +5 -4
  20. data/lib/action_controller/base.rb +6 -9
  21. data/lib/action_controller/caching.rb +1 -3
  22. data/lib/action_controller/log_subscriber.rb +13 -9
  23. data/lib/action_controller/metal/basic_implicit_render.rb +1 -1
  24. data/lib/action_controller/metal/conditional_get.rb +57 -6
  25. data/lib/action_controller/metal/content_security_policy.rb +2 -3
  26. data/lib/action_controller/metal/cookies.rb +4 -2
  27. data/lib/action_controller/metal/data_streaming.rb +9 -18
  28. data/lib/action_controller/metal/default_headers.rb +17 -0
  29. data/lib/action_controller/metal/etag_with_template_digest.rb +4 -6
  30. data/lib/action_controller/metal/exceptions.rb +55 -12
  31. data/lib/action_controller/metal/flash.rb +10 -6
  32. data/lib/action_controller/metal/head.rb +7 -4
  33. data/lib/action_controller/metal/helpers.rb +15 -6
  34. data/lib/action_controller/metal/http_authentication.rb +41 -39
  35. data/lib/action_controller/metal/implicit_render.rb +5 -15
  36. data/lib/action_controller/metal/instrumentation.rb +59 -55
  37. data/lib/action_controller/metal/live.rb +80 -33
  38. data/lib/action_controller/metal/logging.rb +20 -0
  39. data/lib/action_controller/metal/mime_responds.rb +22 -7
  40. data/lib/action_controller/metal/parameter_encoding.rb +35 -4
  41. data/lib/action_controller/metal/params_wrapper.rb +50 -31
  42. data/lib/action_controller/metal/permissions_policy.rb +46 -0
  43. data/lib/action_controller/metal/redirecting.rb +93 -23
  44. data/lib/action_controller/metal/renderers.rb +4 -4
  45. data/lib/action_controller/metal/rendering.rb +14 -9
  46. data/lib/action_controller/metal/request_forgery_protection.rb +160 -58
  47. data/lib/action_controller/metal/rescue.rb +2 -2
  48. data/lib/action_controller/metal/streaming.rb +1 -4
  49. data/lib/action_controller/metal/strong_parameters.rb +236 -88
  50. data/lib/action_controller/metal/testing.rb +9 -2
  51. data/lib/action_controller/metal/url_for.rb +1 -1
  52. data/lib/action_controller/metal.rb +16 -17
  53. data/lib/action_controller/railtie.rb +49 -6
  54. data/lib/action_controller/railties/helpers.rb +1 -1
  55. data/lib/action_controller/renderer.rb +37 -13
  56. data/lib/action_controller/template_assertions.rb +1 -1
  57. data/lib/action_controller/test_case.rb +98 -68
  58. data/lib/action_controller.rb +4 -5
  59. data/lib/action_dispatch/http/cache.rb +45 -32
  60. data/lib/action_dispatch/http/content_disposition.rb +45 -0
  61. data/lib/action_dispatch/http/content_security_policy.rb +69 -56
  62. data/lib/action_dispatch/http/filter_parameters.rb +14 -8
  63. data/lib/action_dispatch/http/filter_redirect.rb +2 -3
  64. data/lib/action_dispatch/http/headers.rb +4 -4
  65. data/lib/action_dispatch/http/mime_negotiation.rb +44 -16
  66. data/lib/action_dispatch/http/mime_type.rb +47 -30
  67. data/lib/action_dispatch/http/parameters.rb +18 -27
  68. data/lib/action_dispatch/http/permissions_policy.rb +173 -0
  69. data/lib/action_dispatch/http/request.rb +49 -35
  70. data/lib/action_dispatch/http/response.rb +34 -26
  71. data/lib/action_dispatch/http/upload.rb +9 -1
  72. data/lib/action_dispatch/http/url.rb +86 -94
  73. data/lib/action_dispatch/journey/formatter.rb +55 -31
  74. data/lib/action_dispatch/journey/gtg/builder.rb +30 -46
  75. data/lib/action_dispatch/journey/gtg/simulator.rb +15 -8
  76. data/lib/action_dispatch/journey/gtg/transition_table.rb +78 -21
  77. data/lib/action_dispatch/journey/nfa/dot.rb +0 -11
  78. data/lib/action_dispatch/journey/nodes/node.rb +83 -16
  79. data/lib/action_dispatch/journey/parser.rb +13 -13
  80. data/lib/action_dispatch/journey/parser.y +1 -1
  81. data/lib/action_dispatch/journey/path/pattern.rb +42 -34
  82. data/lib/action_dispatch/journey/route.rb +14 -31
  83. data/lib/action_dispatch/journey/router/utils.rb +16 -14
  84. data/lib/action_dispatch/journey/router.rb +27 -35
  85. data/lib/action_dispatch/journey/routes.rb +3 -5
  86. data/lib/action_dispatch/journey/scanner.rb +10 -4
  87. data/lib/action_dispatch/journey/visitors.rb +1 -4
  88. data/lib/action_dispatch/journey/visualizer/fsm.js +49 -24
  89. data/lib/action_dispatch/journey/visualizer/index.html.erb +1 -1
  90. data/lib/action_dispatch/journey.rb +0 -2
  91. data/lib/action_dispatch/middleware/actionable_exceptions.rb +45 -0
  92. data/lib/action_dispatch/middleware/callbacks.rb +2 -4
  93. data/lib/action_dispatch/middleware/cookies.rb +136 -113
  94. data/lib/action_dispatch/middleware/debug_exceptions.rb +47 -68
  95. data/lib/action_dispatch/middleware/debug_locks.rb +8 -8
  96. data/lib/action_dispatch/middleware/debug_view.rb +66 -0
  97. data/lib/action_dispatch/middleware/exception_wrapper.rb +79 -30
  98. data/lib/action_dispatch/middleware/executor.rb +4 -1
  99. data/lib/action_dispatch/middleware/flash.rb +10 -12
  100. data/lib/action_dispatch/middleware/host_authorization.rb +159 -0
  101. data/lib/action_dispatch/middleware/public_exceptions.rb +6 -3
  102. data/lib/action_dispatch/middleware/remote_ip.rb +30 -20
  103. data/lib/action_dispatch/middleware/request_id.rb +5 -6
  104. data/lib/action_dispatch/middleware/server_timing.rb +33 -0
  105. data/lib/action_dispatch/middleware/session/abstract_store.rb +16 -3
  106. data/lib/action_dispatch/middleware/session/cache_store.rb +11 -6
  107. data/lib/action_dispatch/middleware/session/cookie_store.rb +24 -19
  108. data/lib/action_dispatch/middleware/show_exceptions.rb +20 -11
  109. data/lib/action_dispatch/middleware/ssl.rb +20 -15
  110. data/lib/action_dispatch/middleware/stack.rb +79 -7
  111. data/lib/action_dispatch/middleware/static.rb +150 -94
  112. data/lib/action_dispatch/middleware/templates/rescues/_actions.html.erb +13 -0
  113. data/lib/action_dispatch/middleware/templates/rescues/_actions.text.erb +0 -0
  114. data/lib/action_dispatch/middleware/templates/rescues/_message_and_suggestions.html.erb +22 -0
  115. data/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb +6 -11
  116. data/lib/action_dispatch/middleware/templates/rescues/_request_and_response.text.erb +1 -1
  117. data/lib/action_dispatch/middleware/templates/rescues/_source.html.erb +4 -2
  118. data/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb +46 -36
  119. data/lib/action_dispatch/middleware/templates/rescues/blocked_host.html.erb +8 -0
  120. data/lib/action_dispatch/middleware/templates/rescues/blocked_host.text.erb +7 -0
  121. data/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb +25 -6
  122. data/lib/action_dispatch/middleware/templates/rescues/diagnostics.text.erb +1 -1
  123. data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb +9 -6
  124. data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb +4 -1
  125. data/lib/action_dispatch/middleware/templates/rescues/layout.erb +121 -15
  126. data/lib/action_dispatch/middleware/templates/rescues/missing_exact_template.html.erb +19 -0
  127. data/lib/action_dispatch/middleware/templates/rescues/missing_exact_template.text.erb +3 -0
  128. data/lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb +5 -5
  129. data/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb +4 -4
  130. data/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +5 -5
  131. data/lib/action_dispatch/middleware/templates/rescues/unknown_action.html.erb +4 -4
  132. data/lib/action_dispatch/middleware/templates/routes/_table.html.erb +16 -2
  133. data/lib/action_dispatch/railtie.rb +16 -4
  134. data/lib/action_dispatch/request/session.rb +59 -22
  135. data/lib/action_dispatch/request/utils.rb +28 -2
  136. data/lib/action_dispatch/routing/inspector.rb +102 -54
  137. data/lib/action_dispatch/routing/mapper.rb +184 -156
  138. data/lib/action_dispatch/routing/polymorphic_routes.rb +21 -19
  139. data/lib/action_dispatch/routing/redirection.rb +4 -6
  140. data/lib/action_dispatch/routing/route_set.rb +83 -73
  141. data/lib/action_dispatch/routing/routes_proxy.rb +1 -1
  142. data/lib/action_dispatch/routing/url_for.rb +2 -3
  143. data/lib/action_dispatch/routing.rb +23 -22
  144. data/lib/action_dispatch/system_test_case.rb +65 -16
  145. data/lib/action_dispatch/system_testing/browser.rb +43 -16
  146. data/lib/action_dispatch/system_testing/driver.rb +42 -10
  147. data/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb +58 -12
  148. data/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb +3 -10
  149. data/lib/action_dispatch/testing/assertion_response.rb +0 -1
  150. data/lib/action_dispatch/testing/assertions/response.rb +4 -7
  151. data/lib/action_dispatch/testing/assertions/routing.rb +20 -8
  152. data/lib/action_dispatch/testing/assertions.rb +3 -6
  153. data/lib/action_dispatch/testing/integration.rb +61 -30
  154. data/lib/action_dispatch/testing/request_encoder.rb +2 -2
  155. data/lib/action_dispatch/testing/test_process.rb +8 -6
  156. data/lib/action_dispatch/testing/test_request.rb +3 -3
  157. data/lib/action_dispatch/testing/test_response.rb +4 -32
  158. data/lib/action_dispatch.rb +15 -7
  159. data/lib/action_pack/gem_version.rb +4 -4
  160. data/lib/action_pack.rb +1 -1
  161. metadata +44 -25
  162. data/lib/action_controller/metal/force_ssl.rb +0 -99
  163. data/lib/action_dispatch/http/parameter_filter.rb +0 -86
  164. data/lib/action_dispatch/journey/nfa/builder.rb +0 -78
  165. data/lib/action_dispatch/journey/nfa/simulator.rb +0 -49
  166. data/lib/action_dispatch/journey/nfa/transition_table.rb +0 -120
  167. data/lib/action_dispatch/system_testing/test_helpers/undef_methods.rb +0 -26
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9305274faee39adcd8d4186fca94a40628c1388306e67fd2ad723211570d6883
4
- data.tar.gz: 4c4817cf6548eb96069927737bcd72050bc7af3e8a369821a9187384c0a1c37d
3
+ metadata.gz: 06e621226ed4db65eca7f6c6a5194702b49e8287e513e241ed511dc096ef320e
4
+ data.tar.gz: 4c7c1405b2e523f77fdd076755c9311528bc5e38fac81823330719846a562736
5
5
  SHA512:
6
- metadata.gz: 9dd5b86c36e7c92df007c0965e4a98216dc8c40fd4e0bef93c65f81a1d9a4dc3547c92e0f93c472802721bdb9bba7851c5384bea6cd396a1bb62f0a97d57b266
7
- data.tar.gz: 07d1e9f9c4829961e66b20d011b9286841794088447c733a0bbeded2a2e13333ae8d9880562348830d3abc52d6a1c2eeabf2434499968b2c39862fd0868641bc
6
+ metadata.gz: a1d0d5c67985a6d93bff849b4fd2c21ebb6f0572d64109aaad0bd47317e72cde6c5ba66d1bcf88fe3378dedb37d788f264405f98d11fc3f9c0a4ccad34d8bf1c
7
+ data.tar.gz: 459de47bc8f00dd8f69b147dac927c30f757657cd5eb3b22518fba2922a0cc96892552f46f32b25bf38aee6ba3deb1ad6272398642befed341621e55d44b88e0
data/CHANGELOG.md CHANGED
@@ -1,357 +1,401 @@
1
- ## Rails 5.2.1 (August 07, 2018) ##
1
+ ## Rails 7.0.2.4 (April 26, 2022) ##
2
2
 
3
- * Prevent `?null=` being passed on JSON encoded test requests.
3
+ * Allow Content Security Policy DSL to generate for API responses.
4
4
 
5
- `RequestEncoder#encode_params` won't attempt to parse params if
6
- there are none.
5
+ *Tim Wade*
7
6
 
8
- So call like this will no longer append a `?null=` query param.
7
+ ## Rails 7.0.2.3 (March 08, 2022) ##
9
8
 
10
- get foos_url, as: :json
9
+ * No changes.
11
10
 
12
- *Alireza Bashiri*
13
11
 
14
- * Ensure `ActionController::Parameters#transform_values` and
15
- `ActionController::Parameters#transform_values!` converts hashes into
16
- parameters.
12
+ ## Rails 7.0.2.2 (February 11, 2022) ##
17
13
 
18
- *Kevin Sjöberg*
14
+ * No changes.
19
15
 
20
- * Fix strong parameters `permit!` with nested arrays.
21
16
 
22
- Given:
23
- ```
24
- params = ActionController::Parameters.new(nested_arrays: [[{ x: 2, y: 3 }, { x: 21, y: 42 }]])
25
- params.permit!
26
- ```
17
+ ## Rails 7.0.2.1 (February 11, 2022) ##
27
18
 
28
- `params[:nested_arrays][0][0].permitted?` will now return `true` instead of `false`.
19
+ * Under certain circumstances, the middleware isn't informed that the
20
+ response body has been fully closed which result in request state not
21
+ being fully reset before the next request
29
22
 
30
- *Steve Hull*
23
+ [CVE-2022-23633]
31
24
 
32
- * Reset `RAW_POST_DATA` and `CONTENT_LENGTH` request environment between test requests in
33
- `ActionController::TestCase` subclasses.
34
25
 
35
- *Eugene Kenny*
26
+ ## Rails 7.0.2 (February 08, 2022) ##
36
27
 
37
- * Output only one Content-Security-Policy nonce header value per request.
28
+ * No changes.
38
29
 
39
- Fixes #32597.
40
30
 
41
- *Andrey Novikov*, *Andrew White*
31
+ ## Rails 7.0.1 (January 06, 2022) ##
42
32
 
43
- * Only disable GPUs for headless Chrome on Windows.
33
+ * Fix `ActionController::Parameters` methods to keep the original logger context when creating a new copy
34
+ of the original object.
44
35
 
45
- It is not necessary anymore for Linux and macOS machines.
36
+ *Yutaka Kamei*
46
37
 
47
- https://bugs.chromium.org/p/chromium/issues/detail?id=737678#c1
48
38
 
49
- *Stefan Wrobel*
39
+ ## Rails 7.0.0 (December 15, 2021) ##
50
40
 
51
- * Fix system tests transactions not closed between examples.
41
+ * Deprecate `Rails.application.config.action_controller.urlsafe_csrf_tokens`. This config is now always enabled.
52
42
 
53
- *Sergey Tarasov*
43
+ *Étienne Barrié*
54
44
 
45
+ * Instance variables set in requests in a `ActionController::TestCase` are now cleared before the next request
55
46
 
56
- ## Rails 5.2.0 (April 09, 2018) ##
47
+ This means if you make multiple requests in the same test, instance variables set in the first request will
48
+ not persist into the second one. (It's not recommended to make multiple requests in the same test.)
57
49
 
58
- * Check exclude before flagging cookies as secure.
50
+ *Alex Ghiculescu*
59
51
 
60
- *Catherine Khuu*
61
52
 
62
- * Always yield a CSP policy instance from `content_security_policy`
53
+ ## Rails 7.0.0.rc3 (December 14, 2021) ##
63
54
 
64
- This allows a controller action to enable the policy individually
65
- for a controller and/or specific actions.
55
+ * No changes.
66
56
 
67
- *Andrew White*
68
57
 
69
- * Add the ability to disable the global CSP in a controller, e.g:
58
+ ## Rails 7.0.0.rc2 (December 14, 2021) ##
70
59
 
71
- class LegacyPagesController < ApplicationController
72
- content_security_policy false, only: :index
73
- end
60
+ * Fix X_FORWARDED_HOST protection. [CVE-2021-44528]
74
61
 
75
- *Andrew White*
76
62
 
77
- * Add alias method `to_hash` to `to_h` for `cookies`.
78
- Add alias method `to_h` to `to_hash` for `session`.
63
+ ## Rails 7.0.0.rc1 (December 06, 2021) ##
79
64
 
80
- *Igor Kasyanchuk*
65
+ * `Rails.application.executor` hooks can now be called around every request in a `ActionController::TestCase`
81
66
 
82
- * Update the default HSTS max-age value to 31536000 seconds (1 year)
83
- to meet the minimum max-age requirement for https://hstspreload.org/.
67
+ This helps to better simulate request or job local state being reset between requests and prevent state
68
+ leaking from one request to another.
84
69
 
85
- *Grant Bourque*
70
+ To enable this, set `config.active_support.executor_around_test_case = true` (this is the default in Rails 7).
86
71
 
87
- * Add support for automatic nonce generation for Rails UJS.
72
+ *Alex Ghiculescu*
88
73
 
89
- Because the UJS library creates a script tag to process responses it
90
- normally requires the script-src attribute of the content security
91
- policy to include 'unsafe-inline'.
74
+ * Consider onion services secure for cookies.
92
75
 
93
- To work around this we generate a per-request nonce value that is
94
- embedded in a meta tag in a similar fashion to how CSRF protection
95
- embeds its token in a meta tag. The UJS library can then read the
96
- nonce value and set it on the dynamically generated script tag to
97
- enable it to execute without needing 'unsafe-inline' enabled.
76
+ *Justin Tracey*
98
77
 
99
- Nonce generation isn't 100% safe - if your script tag is including
100
- user generated content in someway then it may be possible to exploit
101
- an XSS vulnerability which can take advantage of the nonce. It is
102
- however an improvement on a blanket permission for inline scripts.
78
+ * Remove deprecated `Rails.config.action_view.raise_on_missing_translations`.
103
79
 
104
- It is also possible to use the nonce within your own script tags by
105
- using `nonce: true` to set the nonce value on the tag, e.g
80
+ *Rafael Mendonça França*
106
81
 
107
- <%= javascript_tag nonce: true do %>
108
- alert('Hello, World!');
109
- <% end %>
82
+ * Remove deprecated support to passing a path to `fixture_file_upload` relative to `fixture_path`.
110
83
 
111
- Fixes #31689.
84
+ *Rafael Mendonça França*
112
85
 
113
- *Andrew White*
86
+ * Remove deprecated `ActionDispatch::SystemTestCase#host!`.
114
87
 
115
- * Matches behavior of `Hash#each` in `ActionController::Parameters#each`.
88
+ *Rafael Mendonça França*
116
89
 
117
- *Dominic Cleal*
90
+ * Remove deprecated `Rails.config.action_dispatch.hosts_response_app`.
118
91
 
119
- * Add `Referrer-Policy` header to default headers set.
92
+ *Rafael Mendonça França*
120
93
 
121
- *Guillermo Iguaran*
94
+ * Remove deprecated `ActionDispatch::Response.return_only_media_type_on_content_type`.
122
95
 
123
- * Changed the system tests to set Puma as default server only when the
124
- user haven't specified manually another server.
96
+ *Rafael Mendonça França*
125
97
 
126
- *Guillermo Iguaran*
98
+ * Raise `ActionController::Redirecting::UnsafeRedirectError` for unsafe `redirect_to` redirects.
127
99
 
128
- * Add secure `X-Download-Options` and `X-Permitted-Cross-Domain-Policies` to
129
- default headers set.
100
+ This allows `rescue_from` to be used to add a default fallback route:
130
101
 
131
- *Guillermo Iguaran*
102
+ ```ruby
103
+ rescue_from ActionController::Redirecting::UnsafeRedirectError do
104
+ redirect_to root_url
105
+ end
106
+ ```
132
107
 
133
- * Add headless firefox support to System Tests.
108
+ *Kasper Timm Hansen*, *Chris Oliver*
134
109
 
135
- *bogdanvlviv*
110
+ * Add `url_from` to verify a redirect location is internal.
136
111
 
137
- * Changed the default system test screenshot output from `inline` to `simple`.
112
+ Takes the open redirect protection from `redirect_to` so users can wrap a
113
+ param, and fall back to an alternate redirect URL when the param provided
114
+ one is unsafe.
138
115
 
139
- `inline` works well for iTerm2 but not everyone uses iTerm2. Some terminals like
140
- Terminal.app ignore the `inline` and output the path to the file since it can't
141
- render the image. Other terminals, like those on Ubuntu, cannot handle the image
142
- inline, but also don't handle it gracefully and instead of outputting the file
143
- path, it dumps binary into the terminal.
116
+ ```ruby
117
+ def create
118
+ redirect_to url_from(params[:redirect_url]) || root_url
119
+ end
120
+ ```
144
121
 
145
- Commit 9d6e28 fixes this by changing the default for screenshot to be `simple`.
122
+ *dmcge*, *Kasper Timm Hansen*
146
123
 
147
- *Eileen M. Uchitelle*
124
+ * Allow Capybara driver name overrides in `SystemTestCase::driven_by`
148
125
 
149
- * Register most popular audio/video/font mime types supported by modern browsers.
126
+ Allow users to prevent conflicts among drivers that use the same driver
127
+ type (selenium, poltergeist, webkit, rack test).
150
128
 
151
- *Guillermo Iguaran*
129
+ Fixes #42502
152
130
 
153
- * Fix optimized url helpers when using relative url root.
131
+ *Chris LaRose*
154
132
 
155
- Fixes #31220.
133
+ * Allow multiline to be passed in routes when using wildcard segments.
156
134
 
157
- *Andrew White*
135
+ Previously routes with newlines weren't detected when using wildcard segments, returning
136
+ a `No route matches` error.
137
+ After this change, routes with newlines are detected on wildcard segments. Example
158
138
 
159
- * Add DSL for configuring Content-Security-Policy header.
139
+ ```ruby
140
+ draw do
141
+ get "/wildcard/*wildcard_segment", to: SimpleApp.new("foo#index"), as: :wildcard
142
+ end
160
143
 
161
- The DSL allows you to configure a global Content-Security-Policy
162
- header and then override within a controller. For more information
163
- about the Content-Security-Policy header see MDN:
144
+ # After the change, the path matches.
145
+ assert_equal "/wildcard/a%0Anewline", url_helpers.wildcard_path(wildcard_segment: "a\nnewline")
146
+ ```
164
147
 
165
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
148
+ Fixes #39103
166
149
 
167
- Example global policy:
150
+ *Ignacio Chiazzo*
168
151
 
169
- # config/initializers/content_security_policy.rb
170
- Rails.application.config.content_security_policy do |p|
171
- p.default_src :self, :https
172
- p.font_src :self, :https, :data
173
- p.img_src :self, :https, :data
174
- p.object_src :none
175
- p.script_src :self, :https
176
- p.style_src :self, :https, :unsafe_inline
177
- end
152
+ * Treat html suffix in controller translation.
178
153
 
179
- Example controller overrides:
154
+ *Rui Onodera*, *Gavin Miller*
180
155
 
181
- # Override policy inline
182
- class PostsController < ApplicationController
183
- content_security_policy do |p|
184
- p.upgrade_insecure_requests true
185
- end
186
- end
156
+ * Allow permitting numeric params.
187
157
 
188
- # Using literal values
189
- class PostsController < ApplicationController
190
- content_security_policy do |p|
191
- p.base_uri "https://www.example.com"
192
- end
193
- end
158
+ Previously it was impossible to permit different fields on numeric parameters.
159
+ After this change you can specify different fields for each numbered parameter.
160
+ For example params like,
161
+ ```ruby
162
+ book: {
163
+ authors_attributes: {
164
+ '0': { name: "William Shakespeare", age_of_death: "52" },
165
+ '1': { name: "Unattributed Assistant" },
166
+ '2': "Not a hash",
167
+ 'new_record': { name: "Some name" }
168
+ }
169
+ }
170
+ ```
194
171
 
195
- # Using mixed static and dynamic values
196
- class PostsController < ApplicationController
197
- content_security_policy do |p|
198
- p.base_uri :self, -> { "https://#{current_user.domain}.example.com" }
199
- end
200
- end
172
+ Before you could permit name on each author with,
173
+ `permit book: { authors_attributes: [ :name ] }`
201
174
 
202
- Allows you to also only report content violations for migrating
203
- legacy content using the `content_security_policy_report_only`
204
- configuration attribute, e.g;
175
+ After this change you can permit different keys on each numbered element,
176
+ `permit book: { authors_attributes: { '1': [ :name ], '0': [ :name, :age_of_death ] } }`
205
177
 
206
- # config/initializers/content_security_policy.rb
207
- Rails.application.config.content_security_policy_report_only = true
178
+ Fixes #41625
208
179
 
209
- # controller override
210
- class PostsController < ApplicationController
211
- content_security_policy_report_only only: :index
212
- end
180
+ *Adam Hess*
213
181
 
214
- Note that this feature does not validate the header for performance
215
- reasons since the header is calculated at runtime.
182
+ * Update `HostAuthorization` middleware to render debug info only
183
+ when `config.consider_all_requests_local` is set to true.
216
184
 
217
- *Andrew White*
185
+ Also, blocked host info is always logged with level `error`.
218
186
 
219
- * Make `assert_recognizes` to traverse mounted engines.
187
+ Fixes #42813
220
188
 
221
- *Yuichiro Kaneko*
189
+ *Nikita Vyrko*
222
190
 
223
- * Remove deprecated `ActionController::ParamsParser::ParseError`.
191
+ * Add Server-Timing middleware
224
192
 
225
- *Rafael Mendonça França*
193
+ Server-Timing specification defines how the server can communicate to browsers performance metrics
194
+ about the request it is responding to.
195
+
196
+ The ServerTiming middleware is enabled by default on `development` environment by default using the
197
+ `config.server_timing` setting and set the relevant duration metrics in the `Server-Timing` header
198
+
199
+ The full specification for Server-Timing header can be found in: https://www.w3.org/TR/server-timing/#dfn-server-timing-header-field
200
+
201
+ *Sebastian Sogamoso*, *Guillermo Iguaran*
202
+
203
+
204
+ ## Rails 7.0.0.alpha2 (September 15, 2021) ##
226
205
 
227
- * Add `:allow_other_host` option to `redirect_back` method.
206
+ * No changes.
228
207
 
229
- When `allow_other_host` is set to `false`, the `redirect_back` will not allow redirecting from a
230
- different host. `allow_other_host` is `true` by default.
231
208
 
232
- *Tim Masliuchenko*
209
+ ## Rails 7.0.0.alpha1 (September 15, 2021) ##
233
210
 
234
- * Add headless chrome support to System Tests.
211
+ * Use a static error message when raising `ActionDispatch::Http::Parameters::ParseError`
212
+ to avoid inadvertently logging the HTTP request body at the `fatal` level when it contains
213
+ malformed JSON.
235
214
 
236
- *Yuji Yaginuma*
215
+ Fixes #41145
237
216
 
238
- * Add ability to enable Early Hints for HTTP/2
217
+ *Aaron Lahey*
239
218
 
240
- If supported by the server, and enabled in Puma this allows H2 Early Hints to be used.
219
+ * Add `Middleware#delete!` to delete middleware or raise if not found.
241
220
 
242
- The `javascript_include_tag` and the `stylesheet_link_tag` automatically add Early Hints if requested.
221
+ `Middleware#delete!` works just like `Middleware#delete` but will
222
+ raise an error if the middleware isn't found.
243
223
 
244
- *Eileen M. Uchitelle*, *Aaron Patterson*
224
+ *Alex Ghiculescu*, *Petrik de Heus*, *Junichi Sato*
245
225
 
246
- * Simplify cookies middleware with key rotation support
226
+ * Raise error on unpermitted open redirects.
247
227
 
248
- Use the `rotate` method for both `MessageEncryptor` and
249
- `MessageVerifier` to add key rotation support for encrypted and
250
- signed cookies. This also helps simplify support for legacy cookie
251
- security.
228
+ Add `allow_other_host` options to `redirect_to`.
229
+ Opt in to this behaviour with `ActionController::Base.raise_on_open_redirects = true`.
252
230
 
253
- *Michael J Coyne*
231
+ *Gannon McGibbon*
254
232
 
255
- * Use Capybara registered `:puma` server config.
233
+ * Deprecate `poltergeist` and `webkit` (capybara-webkit) driver registration for system testing (they will be removed in Rails 7.1). Add `cuprite` instead.
256
234
 
257
- The Capybara registered `:puma` server ensures the puma server is run in process so
258
- connection sharing and open request detection work correctly by default.
235
+ [Poltergeist](https://github.com/teampoltergeist/poltergeist) and [capybara-webkit](https://github.com/thoughtbot/capybara-webkit) are already not maintained. These usage in Rails are removed for avoiding confusing users.
259
236
 
260
- *Thomas Walpole*
237
+ [Cuprite](https://github.com/rubycdp/cuprite) is a good alternative to Poltergeist. Some guide descriptions are replaced from Poltergeist to Cuprite.
261
238
 
262
- * Cookies `:expires` option supports `ActiveSupport::Duration` object.
239
+ *Yusuke Iwaki*
263
240
 
264
- cookies[:user_name] = { value: "assain", expires: 1.hour }
265
- cookies[:key] = { value: "a yummy cookie", expires: 6.months }
241
+ * Exclude additional flash types from `ActionController::Base.action_methods`.
266
242
 
267
- Pull Request: #30121
243
+ Ensures that additional flash types defined on ActionController::Base subclasses
244
+ are not listed as actions on that controller.
268
245
 
269
- *Assain Jaleel*
246
+ class MyController < ApplicationController
247
+ add_flash_types :hype
248
+ end
249
+
250
+ MyController.action_methods.include?('hype') # => false
251
+
252
+ *Gavin Morrice*
253
+
254
+ * OpenSSL constants are now used for Digest computations.
270
255
 
271
- * Enforce signed/encrypted cookie expiry server side.
256
+ *Dirkjan Bussink*
272
257
 
273
- Rails can thwart attacks by malicious clients that don't honor a cookie's expiry.
258
+ * Remove IE6-7-8 file download related hack/fix from ActionController::DataStreaming module.
274
259
 
275
- It does so by stashing the expiry within the written cookie and relying on the
276
- signing/encrypting to vouch that it hasn't been tampered with. Then on a
277
- server-side read, the expiry is verified and any expired cookie is discarded.
260
+ Due to the age of those versions of IE this fix is no longer relevant, more importantly it creates an edge-case for unexpected Cache-Control headers.
278
261
 
279
- Pull Request: #30121
262
+ *Tadas Sasnauskas*
280
263
 
281
- *Assain Jaleel*
264
+ * Configuration setting to skip logging an uncaught exception backtrace when the exception is
265
+ present in `rescued_responses`.
282
266
 
283
- * Make `take_failed_screenshot` work within engine.
267
+ It may be too noisy to get all backtraces logged for applications that manage uncaught
268
+ exceptions via `rescued_responses` and `exceptions_app`.
269
+ `config.action_dispatch.log_rescued_responses` (defaults to `true`) can be set to `false` in
270
+ this case, so that only exceptions not found in `rescued_responses` will be logged.
271
+
272
+ *Alexander Azarov*, *Mike Dalessio*
273
+
274
+ * Ignore file fixtures on `db:fixtures:load`.
275
+
276
+ *Kevin Sjöberg*
284
277
 
285
- Fixes #30405.
278
+ * Fix ActionController::Live controller test deadlocks by removing the body buffer size limit for tests.
286
279
 
287
- *Yuji Yaginuma*
280
+ *Dylan Thacker-Smith*
288
281
 
289
- * Deprecate `ActionDispatch::TestResponse` response aliases.
282
+ * New `ActionController::ConditionalGet#no_store` method to set HTTP cache control `no-store` directive.
290
283
 
291
- `#success?`, `#missing?` & `#error?` are not supported by the actual
292
- `ActionDispatch::Response` object and can produce false-positives. Instead,
293
- use the response helpers provided by `Rack::Response`.
284
+ *Tadas Sasnauskas*
294
285
 
295
- *Trevor Wistaff*
286
+ * Drop support for the `SERVER_ADDR` header.
296
287
 
297
- * Protect from forgery by default
288
+ Following up https://github.com/rack/rack/pull/1573 and https://github.com/rails/rails/pull/42349.
298
289
 
299
- Rather than protecting from forgery in the generated `ApplicationController`,
300
- add it to `ActionController::Base` depending on
301
- `config.action_controller.default_protect_from_forgery`. This configuration
302
- defaults to false to support older versions which have removed it from their
303
- `ApplicationController`, but is set to true for Rails 5.2.
290
+ *Ricardo Díaz*
304
291
 
305
- *Lisa Ugray*
292
+ * Set session options when initializing a basic session.
306
293
 
307
- * Fallback `ActionController::Parameters#to_s` to `Hash#to_s`.
294
+ *Gannon McGibbon*
308
295
 
309
- *Kir Shatrov*
296
+ * Add `cache_control: {}` option to `fresh_when` and `stale?`.
310
297
 
311
- * `driven_by` now registers poltergeist and capybara-webkit.
298
+ Works as a shortcut to set `response.cache_control` with the above methods.
312
299
 
313
- If poltergeist or capybara-webkit are set as drivers is set for System Tests,
314
- `driven_by` will register the driver and set additional options passed via
315
- the `:options` parameter.
300
+ *Jacopo Beschi*
316
301
 
317
- Refer to the respective driver's documentation to see what options can be passed.
302
+ * Writing into a disabled session will now raise an error.
318
303
 
319
- *Mario Chavez*
304
+ Previously when no session store was set, writing into the session would silently fail.
320
305
 
321
- * AEAD encrypted cookies and sessions with GCM.
306
+ *Jean Boussier*
322
307
 
323
- Encrypted cookies now use AES-GCM which couples authentication and
324
- encryption in one faster step and produces shorter ciphertexts. Cookies
325
- encrypted using AES in CBC HMAC mode will be seamlessly upgraded when
326
- this new mode is enabled via the
327
- `action_dispatch.use_authenticated_cookie_encryption` configuration value.
308
+ * Add support for 'require-trusted-types-for' and 'trusted-types' headers.
328
309
 
329
- *Michael J Coyne*
310
+ Fixes #42034.
330
311
 
331
- * Change the cache key format for fragments to make it easier to debug key churn. The new format is:
312
+ *lfalcao*
332
313
 
333
- views/template/action.html.erb:7a1156131a6928cb0026877f8b749ac9/projects/123
334
- ^template path ^template tree digest ^class ^id
314
+ * Remove inline styles and address basic accessibility issues on rescue templates.
315
+
316
+ *Jacob Herrington*
317
+
318
+ * Add support for 'private, no-store' Cache-Control headers.
319
+
320
+ Previously, 'no-store' was exclusive; no other directives could be specified.
321
+
322
+ *Alex Smith*
323
+
324
+ * Expand payload of `unpermitted_parameters.action_controller` instrumentation to allow subscribers to
325
+ know which controller action received unpermitted parameters.
326
+
327
+ *bbuchalter*
328
+
329
+ * Add `ActionController::Live#send_stream` that makes it more convenient to send generated streams:
330
+
331
+ ```ruby
332
+ send_stream(filename: "subscribers.csv") do |stream|
333
+ stream.writeln "email_address,updated_at"
334
+
335
+ @subscribers.find_each do |subscriber|
336
+ stream.writeln [ subscriber.email_address, subscriber.updated_at ].join(",")
337
+ end
338
+ end
339
+ ```
335
340
 
336
341
  *DHH*
337
342
 
338
- * Add support for recyclable cache keys with fragment caching. This uses the new versioned entries in the
339
- `ActiveSupport::Cache` stores and relies on the fact that Active Record has split `#cache_key` and `#cache_version`
340
- to support it.
343
+ * Add `ActionController::Live::Buffer#writeln` to write a line to the stream with a newline included.
341
344
 
342
345
  *DHH*
343
346
 
344
- * Add `action_controller_api` and `action_controller_base` load hooks to be called in `ActiveSupport.on_load`
347
+ * `ActionDispatch::Request#content_type` now returned Content-Type header as it is.
348
+
349
+ Previously, `ActionDispatch::Request#content_type` returned value does NOT contain charset part.
350
+ This behavior changed to returned Content-Type header containing charset part as it is.
351
+
352
+ If you want just MIME type, please use `ActionDispatch::Request#media_type` instead.
345
353
 
346
- `ActionController::Base` and `ActionController::API` have differing implementations. This means that
347
- the one umbrella hook `action_controller` is not able to address certain situations where a method
348
- may not exist in a certain implementation.
354
+ Before:
349
355
 
350
- This is fixed by adding two new hooks so you can target `ActionController::Base` vs `ActionController::API`
356
+ ```ruby
357
+ request = ActionDispatch::Request.new("CONTENT_TYPE" => "text/csv; header=present; charset=utf-16", "REQUEST_METHOD" => "GET")
358
+ request.content_type #=> "text/csv"
359
+ ```
360
+
361
+ After:
351
362
 
352
- Fixes #27013.
363
+ ```ruby
364
+ request = ActionDispatch::Request.new("Content-Type" => "text/csv; header=present; charset=utf-16", "REQUEST_METHOD" => "GET")
365
+ request.content_type #=> "text/csv; header=present; charset=utf-16"
366
+ request.media_type #=> "text/csv"
367
+ ```
353
368
 
354
- *Julian Nadeau*
369
+ *Rafael Mendonça França*
370
+
371
+ * Change `ActionDispatch::Request#media_type` to return `nil` when the request don't have a `Content-Type` header.
372
+
373
+ *Rafael Mendonça França*
374
+
375
+ * Fix error in `ActionController::LogSubscriber` that would happen when throwing inside a controller action.
376
+
377
+ *Janko Marohnić*
378
+
379
+ * Allow anything with `#to_str` (like `Addressable::URI`) as a `redirect_to` location.
380
+
381
+ *ojab*
382
+
383
+ * Change the request method to a `GET` when passing failed requests down to `config.exceptions_app`.
384
+
385
+ *Alex Robbin*
386
+
387
+ * Deprecate the ability to assign a single value to `config.action_dispatch.trusted_proxies`
388
+ as `RemoteIp` middleware behaves inconsistently depending on whether this is configured
389
+ with a single value or an enumerable.
390
+
391
+ Fixes #40772.
392
+
393
+ *Christian Sutter*
394
+
395
+ * Add `redirect_back_or_to(fallback_location, **)` as a more aesthetically pleasing version of `redirect_back fallback_location:, **`.
396
+ The old method name is retained without explicit deprecation.
397
+
398
+ *DHH*
355
399
 
356
400
 
357
- Please check [5-1-stable](https://github.com/rails/rails/blob/5-1-stable/actionpack/CHANGELOG.md) for previous changes.
401
+ Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/actionpack/CHANGELOG.md) for previous changes.
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2004-2018 David Heinemeier Hansson
1
+ Copyright (c) 2004-2022 David Heinemeier Hansson
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the