actionpack 7.0.4.3 → 7.0.8.6

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.

Potentially problematic release.


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

Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +117 -1
  3. data/README.rdoc +2 -2
  4. data/lib/abstract_controller/helpers.rb +15 -11
  5. data/lib/abstract_controller/rendering.rb +9 -11
  6. data/lib/abstract_controller/translation.rb +25 -3
  7. data/lib/action_controller/api.rb +1 -1
  8. data/lib/action_controller/metal/basic_implicit_render.rb +3 -1
  9. data/lib/action_controller/metal/conditional_get.rb +121 -123
  10. data/lib/action_controller/metal/content_security_policy.rb +4 -4
  11. data/lib/action_controller/metal/data_streaming.rb +18 -18
  12. data/lib/action_controller/metal/etag_with_flash.rb +1 -1
  13. data/lib/action_controller/metal/head.rb +1 -1
  14. data/lib/action_controller/metal/http_authentication.rb +2 -1
  15. data/lib/action_controller/metal/live.rb +1 -1
  16. data/lib/action_controller/metal/permissions_policy.rb +1 -1
  17. data/lib/action_controller/metal/redirecting.rb +20 -3
  18. data/lib/action_controller/metal/renderers.rb +2 -2
  19. data/lib/action_controller/metal/rendering.rb +114 -2
  20. data/lib/action_controller/metal/request_forgery_protection.rb +5 -3
  21. data/lib/action_controller/metal/rescue.rb +4 -3
  22. data/lib/action_controller/metal/streaming.rb +1 -1
  23. data/lib/action_controller/metal/strong_parameters.rb +40 -63
  24. data/lib/action_controller/metal/url_for.rb +2 -4
  25. data/lib/action_controller/railtie.rb +2 -1
  26. data/lib/action_controller/renderer.rb +1 -20
  27. data/lib/action_dispatch/http/cache.rb +7 -7
  28. data/lib/action_dispatch/http/content_security_policy.rb +5 -1
  29. data/lib/action_dispatch/http/filter_parameters.rb +13 -28
  30. data/lib/action_dispatch/http/headers.rb +1 -1
  31. data/lib/action_dispatch/http/permissions_policy.rb +0 -7
  32. data/lib/action_dispatch/http/request.rb +15 -16
  33. data/lib/action_dispatch/http/response.rb +0 -4
  34. data/lib/action_dispatch/http/upload.rb +13 -2
  35. data/lib/action_dispatch/middleware/cookies.rb +6 -6
  36. data/lib/action_dispatch/middleware/host_authorization.rb +12 -5
  37. data/lib/action_dispatch/middleware/remote_ip.rb +4 -4
  38. data/lib/action_dispatch/middleware/request_id.rb +2 -2
  39. data/lib/action_dispatch/middleware/show_exceptions.rb +10 -7
  40. data/lib/action_dispatch/middleware/static.rb +3 -3
  41. data/lib/action_dispatch/middleware/templates/rescues/blocked_host.html.erb +7 -3
  42. data/lib/action_dispatch/middleware/templates/rescues/blocked_host.text.erb +5 -3
  43. data/lib/action_dispatch/middleware/templates/routes/_table.html.erb +17 -8
  44. data/lib/action_dispatch/routing/mapper.rb +23 -0
  45. data/lib/action_dispatch/routing/url_for.rb +21 -21
  46. data/lib/action_dispatch/system_testing/browser.rb +1 -1
  47. data/lib/action_dispatch/system_testing/driver.rb +1 -1
  48. data/lib/action_dispatch/testing/assertions/response.rb +1 -1
  49. data/lib/action_pack/gem_version.rb +2 -2
  50. metadata +17 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a6767fc53a6245fa8cf50e270d45f161b736ecac2617775983506517053fc85c
4
- data.tar.gz: 46c3f7e78ff2cac14ca4eefbf1eb3d72fc41e514571356eec3fc9693ce04d7d7
3
+ metadata.gz: 76f2e4ab652796862473bcf69baca0be66d20e972be7b6604b7477f4bfb9e773
4
+ data.tar.gz: cb4eb95dccda5350e577c88faeba18644013acf30496a026866266b0a44efe99
5
5
  SHA512:
6
- metadata.gz: 74c5700fdeecb9ca7ab1b60c88dcc30f55cf04c62ba7ac4204aad1b787ef7686ab0354a3ae462738f01333867dbcf2df676250797cb6022f8241b1eb3bdc1f86
7
- data.tar.gz: 715809e75921eaef199ff1f775a6756c21be3954942189ed817a763ed5197c5aaac85b8620b684324d7e117e9b804572911de4e3d442eb3169f59229f233691a
6
+ metadata.gz: f895845c05ca602877bece43b5d30fb2a16ecce365e7ab41682c8adf021a2cfe8317fedf12c863a153219a583e95847a782c577a96f95cc97c40b1b2014fa2c1
7
+ data.tar.gz: 0e9767733ed255b38198c26dee3c5247fc9ae923b2a22720fbd0cd00842aab15b5e9f3be5357810d387638953811afc21db0c6e70d27a65b6e6315c13af91bf5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,120 @@
1
+ ## Rails 7.0.8.6 (October 23, 2024) ##
2
+
3
+ * No changes.
4
+
5
+
6
+ ## Rails 7.0.8.5 (October 15, 2024) ##
7
+
8
+ * Avoid regex backtracking in HTTP Token authentication
9
+
10
+ [CVE-2024-47887]
11
+
12
+ * Avoid regex backtracking in query parameter filtering
13
+
14
+ [CVE-2024-41128]
15
+
16
+
17
+ ## Rails 7.0.8.4 (June 04, 2024) ##
18
+
19
+ * Include the HTTP Permissions-Policy on non-HTML Content-Types
20
+ [CVE-2024-28103]
21
+
22
+
23
+ ## Rails 7.0.8.3 (May 17, 2024) ##
24
+
25
+ * No changes.
26
+
27
+
28
+ ## Rails 7.0.8.2 (May 16, 2024) ##
29
+
30
+ * No changes.
31
+
32
+
33
+ ## Rails 7.0.8.1 (February 21, 2024) ##
34
+
35
+ * Fix possible XSS vulnerability with the `translate` method in controllers
36
+
37
+ CVE-2024-26143
38
+
39
+ ## Rails 7.0.8 (September 09, 2023) ##
40
+
41
+ * Fix `HostAuthorization` potentially displaying the value of the
42
+ X_FORWARDED_HOST header when the HTTP_HOST header is being blocked.
43
+
44
+ *Hartley McGuire*, *Daniel Schlosser*
45
+
46
+
47
+ ## Rails 7.0.7.2 (August 22, 2023) ##
48
+
49
+ * No changes.
50
+
51
+
52
+ ## Rails 7.0.7.1 (August 22, 2023) ##
53
+
54
+ * No changes.
55
+
56
+
57
+ ## Rails 7.0.7 (August 09, 2023) ##
58
+
59
+ * No changes.
60
+
61
+
62
+ ## Rails 7.0.6 (June 29, 2023) ##
63
+
64
+ * No changes.
65
+
66
+
67
+ ## Rails 7.0.5.1 (June 26, 2023) ##
68
+
69
+ * Raise an exception if illegal characters are provide to redirect_to
70
+ [CVE-2023-28362]
71
+
72
+ *Zack Deveau*
73
+
74
+ ## Rails 7.0.5 (May 24, 2023) ##
75
+
76
+ * Do not return CSP headers for 304 Not Modified responses.
77
+
78
+ *Tobias Kraze*
79
+
80
+ * Fix `EtagWithFlash` when there is no `Flash` middleware available.
81
+
82
+ *fatkodima*
83
+
84
+ * Fix content-type header with `send_stream`.
85
+
86
+ *Elliot Crosby-McCullough*
87
+
88
+ * Address Selenium `:capabilities` deprecation warning.
89
+
90
+ *Ron Shinall*
91
+
92
+ * Fix cookie domain for domain: all on two letter single level TLD.
93
+
94
+ *John Hawthorn*
95
+
96
+ * Don't double log the `controller`, `action`, or `namespaced_controller` when using `ActiveRecord::QueryLog`
97
+
98
+ Previously if you set `config.active_record.query_log_tags` to an array that included
99
+ `:controller`, `:namespaced_controller`, or `:action`, that item would get logged twice.
100
+ This bug has been fixed.
101
+
102
+ *Alex Ghiculescu*
103
+
104
+ * Rescue `EOFError` exception from `rack` on a multipart request.
105
+
106
+ *Nikita Vasilevsky*
107
+
108
+ * Rescue `JSON::ParserError` in Cookies json deserializer to discards marshal dumps:
109
+
110
+ Without this change, if `action_dispatch.cookies_serializer` is set to `:json` and
111
+ the app tries to read a `:marshal` serialized cookie, it would error out which wouldn't
112
+ clear the cookie and force app users to manually clear it in their browser.
113
+
114
+ (See #45127 for original bug discussion)
115
+
116
+ *Nathan Bardoux*
117
+
1
118
  ## Rails 7.0.4.3 (March 13, 2023) ##
2
119
 
3
120
  * No changes.
@@ -29,7 +146,6 @@
29
146
 
30
147
  [CVE-2023-22792]
31
148
 
32
-
33
149
  ## Rails 7.0.4 (September 09, 2022) ##
34
150
 
35
151
  * Prevent `ActionDispatch::ServerTiming` from overwriting existing values in `Server-Timing`.
data/README.rdoc CHANGED
@@ -30,7 +30,7 @@ The latest version of Action Pack can be installed with RubyGems:
30
30
 
31
31
  $ gem install actionpack
32
32
 
33
- Source code can be downloaded as part of the Rails project on GitHub:
33
+ Source code can be downloaded as part of the \Rails project on GitHub:
34
34
 
35
35
  * https://github.com/rails/rails/tree/main/actionpack
36
36
 
@@ -48,7 +48,7 @@ API documentation is at:
48
48
 
49
49
  * https://api.rubyonrails.org
50
50
 
51
- Bug reports for the Ruby on Rails project can be filed here:
51
+ Bug reports for the Ruby on \Rails project can be filed here:
52
52
 
53
53
  * https://github.com/rails/rails/issues
54
54
 
@@ -61,13 +61,14 @@ module AbstractController
61
61
  # class ApplicationController < ActionController::Base
62
62
  # helper_method :current_user, :logged_in?
63
63
  #
64
- # def current_user
65
- # @current_user ||= User.find_by(id: session[:user])
66
- # end
67
- #
68
- # def logged_in?
69
- # current_user != nil
70
- # end
64
+ # private
65
+ # def current_user
66
+ # @current_user ||= User.find_by(id: session[:user])
67
+ # end
68
+ #
69
+ # def logged_in?
70
+ # current_user != nil
71
+ # end
71
72
  # end
72
73
  #
73
74
  # In a view:
@@ -84,10 +85,13 @@ module AbstractController
84
85
  file, line = location.path, location.lineno
85
86
 
86
87
  methods.each do |method|
87
- _helpers_for_modification.class_eval <<~ruby_eval, file, line
88
- def #{method}(*args, &block) # def current_user(*args, &block)
89
- controller.send(:'#{method}', *args, &block) # controller.send(:'current_user', *args, &block)
90
- end # end
88
+ # def current_user(*args, &block)
89
+ # controller.send(:'current_user', *args, &block)
90
+ # end
91
+ _helpers_for_modification.class_eval <<~ruby_eval.lines.map(&:strip).join(";"), file, line
92
+ def #{method}(*args, &block)
93
+ controller.send(:'#{method}', *args, &block)
94
+ end
91
95
  ruby2_keywords(:'#{method}')
92
96
  ruby_eval
93
97
  end
@@ -18,8 +18,10 @@ module AbstractController
18
18
  extend ActiveSupport::Concern
19
19
  include ActionView::ViewPaths
20
20
 
21
- # Normalizes arguments, options and then delegates render_to_body and
21
+ # Normalizes arguments and options, and then delegates to render_to_body and
22
22
  # sticks the result in <tt>self.response_body</tt>.
23
+ #
24
+ # Supported options depend on the underlying +render_to_body+ implementation.
23
25
  def render(*args, &block)
24
26
  options = _normalize_render(*args, &block)
25
27
  rendered_body = render_to_body(options)
@@ -32,16 +34,12 @@ module AbstractController
32
34
  self.response_body = rendered_body
33
35
  end
34
36
 
35
- # Raw rendering of a template to a string.
36
- #
37
- # It is similar to render, except that it does not
38
- # set the +response_body+ and it should be guaranteed
39
- # to always return a string.
37
+ # Similar to #render, but only returns the rendered template as a string,
38
+ # instead of setting +self.response_body+.
40
39
  #
41
- # If a component extends the semantics of +response_body+
42
- # (as ActionController extends it to be anything that
43
- # responds to the method each), this method needs to be
44
- # overridden in order to still return a string.
40
+ # If a component extends the semantics of +response_body+ (as ActionController
41
+ # extends it to be anything that responds to the method each), this method
42
+ # needs to be overridden in order to still return a string.
45
43
  def render_to_string(*args, &block)
46
44
  options = _normalize_render(*args, &block)
47
45
  render_to_body(options)
@@ -51,7 +49,7 @@ module AbstractController
51
49
  def render_to_body(options = {})
52
50
  end
53
51
 
54
- # Returns Content-Type of rendered content.
52
+ # Returns +Content-Type+ of rendered content.
55
53
  def rendered_format
56
54
  Mime[:text]
57
55
  end
@@ -6,7 +6,7 @@ module AbstractController
6
6
  module Translation
7
7
  mattr_accessor :raise_on_missing_translations, default: false
8
8
 
9
- # Delegates to <tt>I18n.translate</tt>. Also aliased as <tt>t</tt>.
9
+ # Delegates to <tt>I18n.translate</tt>.
10
10
  #
11
11
  # When the given key starts with a period, it will be scoped by the current
12
12
  # controller and action. So if you call <tt>translate(".foo")</tt> from
@@ -25,14 +25,36 @@ module AbstractController
25
25
 
26
26
  i18n_raise = options.fetch(:raise, self.raise_on_missing_translations)
27
27
 
28
- ActiveSupport::HtmlSafeTranslation.translate(key, **options, raise: i18n_raise)
28
+ if options[:default]
29
+ options[:default] = [options[:default]] unless options[:default].is_a?(Array)
30
+ options[:default] = options[:default].map do |value|
31
+ value.is_a?(String) ? ERB::Util.html_escape(value) : value
32
+ end
33
+ end
34
+
35
+ unless i18n_raise
36
+ options[:default] = [] unless options[:default]
37
+ options[:default] << MISSING_TRANSLATION
38
+ end
39
+
40
+ result = ActiveSupport::HtmlSafeTranslation.translate(key, **options, raise: i18n_raise)
41
+
42
+ if result == MISSING_TRANSLATION
43
+ +"translation missing: #{key}"
44
+ else
45
+ result
46
+ end
29
47
  end
30
48
  alias :t :translate
31
49
 
32
- # Delegates to <tt>I18n.localize</tt>. Also aliased as <tt>l</tt>.
50
+ # Delegates to <tt>I18n.localize</tt>.
33
51
  def localize(object, **options)
34
52
  I18n.localize(object, **options)
35
53
  end
36
54
  alias :l :localize
55
+
56
+ private
57
+ MISSING_TRANSLATION = -(2**60)
58
+ private_constant :MISSING_TRANSLATION
37
59
  end
38
60
  end
@@ -40,7 +40,7 @@ module ActionController
40
40
  # can use <tt>render :json</tt> and siblings freely in your controllers. Keep
41
41
  # in mind that templates are not going to be rendered, so you need to ensure
42
42
  # your controller is calling either <tt>render</tt> or <tt>redirect_to</tt> in
43
- # all actions, otherwise it will return 204 No Content.
43
+ # all actions, otherwise it will return <tt>204 No Content</tt>.
44
44
  #
45
45
  # def show
46
46
  # post = Post.find(params[:id])
@@ -3,7 +3,9 @@
3
3
  module ActionController
4
4
  module BasicImplicitRender # :nodoc:
5
5
  def send_action(method, *args)
6
- super.tap { default_render unless performed? }
6
+ ret = super
7
+ default_render unless performed?
8
+ ret
7
9
  end
8
10
 
9
11
  def default_render