actionpack 7.0.2.4 → 7.0.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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +80 -0
  3. data/lib/abstract_controller/base.rb +6 -5
  4. data/lib/abstract_controller/callbacks.rb +1 -1
  5. data/lib/abstract_controller/helpers.rb +1 -1
  6. data/lib/action_controller/api.rb +5 -5
  7. data/lib/action_controller/base.rb +5 -4
  8. data/lib/action_controller/form_builder.rb +2 -2
  9. data/lib/action_controller/metal/conditional_get.rb +1 -1
  10. data/lib/action_controller/metal/content_security_policy.rb +35 -1
  11. data/lib/action_controller/metal/helpers.rb +1 -1
  12. data/lib/action_controller/metal/http_authentication.rb +56 -29
  13. data/lib/action_controller/metal/live.rb +1 -0
  14. data/lib/action_controller/metal/permissions_policy.rb +18 -27
  15. data/lib/action_controller/metal/redirecting.rb +4 -3
  16. data/lib/action_controller/metal/renderers.rb +10 -11
  17. data/lib/action_controller/metal/rendering.rb +3 -3
  18. data/lib/action_controller/metal/request_forgery_protection.rb +4 -4
  19. data/lib/action_controller/metal/streaming.rb +5 -5
  20. data/lib/action_controller/metal/strong_parameters.rb +13 -4
  21. data/lib/action_controller/metal/url_for.rb +3 -3
  22. data/lib/action_controller/metal.rb +3 -3
  23. data/lib/action_controller/renderer.rb +1 -1
  24. data/lib/action_controller/test_case.rb +3 -3
  25. data/lib/action_controller.rb +1 -0
  26. data/lib/action_dispatch/http/content_security_policy.rb +71 -1
  27. data/lib/action_dispatch/http/mime_negotiation.rb +2 -2
  28. data/lib/action_dispatch/http/permissions_policy.rb +16 -0
  29. data/lib/action_dispatch/http/request.rb +2 -2
  30. data/lib/action_dispatch/http/response.rb +2 -3
  31. data/lib/action_dispatch/middleware/cookies.rb +6 -3
  32. data/lib/action_dispatch/middleware/flash.rb +8 -7
  33. data/lib/action_dispatch/middleware/request_id.rb +1 -1
  34. data/lib/action_dispatch/middleware/server_timing.rb +53 -10
  35. data/lib/action_dispatch/middleware/session/cookie_store.rb +9 -9
  36. data/lib/action_dispatch/routing/mapper.rb +5 -5
  37. data/lib/action_dispatch/routing/redirection.rb +5 -0
  38. data/lib/action_dispatch/routing/route_set.rb +3 -1
  39. data/lib/action_dispatch/routing/url_for.rb +3 -3
  40. data/lib/action_dispatch/routing.rb +3 -4
  41. data/lib/action_dispatch/testing/assertions/routing.rb +3 -2
  42. data/lib/action_dispatch/testing/test_response.rb +20 -2
  43. data/lib/action_pack/gem_version.rb +3 -3
  44. data/lib/action_pack/version.rb +1 -1
  45. metadata +12 -12
@@ -9,14 +9,14 @@ module ActionDispatch
9
9
  # This cookie-based session store is the Rails default. It is
10
10
  # dramatically faster than the alternatives.
11
11
  #
12
- # Sessions typically contain at most a user_id and flash message; both fit
13
- # within the 4096 bytes cookie size limit. A CookieOverflow exception is raised if
12
+ # Sessions typically contain at most a user ID and flash message; both fit
13
+ # within the 4096 bytes cookie size limit. A +CookieOverflow+ exception is raised if
14
14
  # you attempt to store more than 4096 bytes of data.
15
15
  #
16
16
  # The cookie jar used for storage is automatically configured to be the
17
17
  # best possible option given your application's configuration.
18
18
  #
19
- # Your cookies will be encrypted using your apps secret_key_base. This
19
+ # Your cookies will be encrypted using your application's +secret_key_base+. This
20
20
  # goes a step further than signed cookies in that encrypted cookies cannot
21
21
  # be altered or read by users. This is the default starting in Rails 4.
22
22
  #
@@ -24,28 +24,28 @@ module ActionDispatch
24
24
  #
25
25
  # Rails.application.config.session_store :cookie_store, key: '_your_app_session'
26
26
  #
27
- # In the development and test environments your application's secret key base is
27
+ # In the development and test environments your application's +secret_key_base+ is
28
28
  # generated by Rails and stored in a temporary file in <tt>tmp/development_secret.txt</tt>.
29
29
  # In all other environments, it is stored encrypted in the
30
30
  # <tt>config/credentials.yml.enc</tt> file.
31
31
  #
32
- # If your application was not updated to Rails 5.2 defaults, the secret_key_base
32
+ # If your application was not updated to Rails 5.2 defaults, the +secret_key_base+
33
33
  # will be found in the old <tt>config/secrets.yml</tt> file.
34
34
  #
35
- # Note that changing your secret_key_base will invalidate all existing session.
35
+ # Note that changing your +secret_key_base+ will invalidate all existing session.
36
36
  # Additionally, you should take care to make sure you are not relying on the
37
37
  # ability to decode signed cookies generated by your app in external
38
38
  # applications or JavaScript before changing it.
39
39
  #
40
- # Because CookieStore extends Rack::Session::Abstract::Persisted, many of the
40
+ # Because CookieStore extends +Rack::Session::Abstract::Persisted+, many of the
41
41
  # options described there can be used to customize the session cookie that
42
42
  # is generated. For example:
43
43
  #
44
44
  # Rails.application.config.session_store :cookie_store, expire_after: 14.days
45
45
  #
46
46
  # would set the session cookie to expire automatically 14 days after creation.
47
- # Other useful options include <tt>:key</tt>, <tt>:secure</tt> and
48
- # <tt>:httponly</tt>.
47
+ # Other useful options include <tt>:key</tt>, <tt>:secure</tt>,
48
+ # <tt>:httponly</tt>, and <tt>:same_site</tt>.
49
49
  class CookieStore < AbstractSecureStore
50
50
  class SessionId < DelegateClass(Rack::Session::SessionId)
51
51
  attr_reader :cookie_value
@@ -390,10 +390,10 @@ module ActionDispatch
390
390
  #
391
391
  # If you want to expose your action to both GET and POST, use:
392
392
  #
393
- # # sets :controller, :action and :id in params
393
+ # # sets :controller, :action, and :id in params
394
394
  # match ':controller/:action/:id', via: [:get, :post]
395
395
  #
396
- # Note that +:controller+, +:action+ and +:id+ are interpreted as URL
396
+ # Note that +:controller+, +:action+, and +:id+ are interpreted as URL
397
397
  # query parameters and thus available through +params+ in an action.
398
398
  #
399
399
  # If you want to expose your action to GET, use +get+ in the router:
@@ -609,7 +609,7 @@ module ActionDispatch
609
609
  target_as = name_for_action(options[:as], path)
610
610
  options[:via] ||= :all
611
611
 
612
- match(path, options.merge(to: app, anchor: false, format: false))
612
+ match(path, { to: app, anchor: false, format: false }.merge(options))
613
613
 
614
614
  define_generate_prefix(app, target_as) if rails_app
615
615
  self
@@ -906,7 +906,7 @@ module ActionDispatch
906
906
  #
907
907
  # === Options
908
908
  #
909
- # The +:path+, +:as+, +:module+, +:shallow_path+ and +:shallow_prefix+
909
+ # The +:path+, +:as+, +:module+, +:shallow_path+, and +:shallow_prefix+
910
910
  # options all default to the name of the namespace.
911
911
  #
912
912
  # For options, see <tt>Base#match</tt>. For +:shallow_path+ option, see
@@ -1082,7 +1082,7 @@ module ActionDispatch
1082
1082
 
1083
1083
  # Resource routing allows you to quickly declare all of the common routes
1084
1084
  # for a given resourceful controller. Instead of declaring separate routes
1085
- # for your +index+, +show+, +new+, +edit+, +create+, +update+ and +destroy+
1085
+ # for your +index+, +show+, +new+, +edit+, +create+, +update+, and +destroy+
1086
1086
  # actions, a resourceful route declares them in a single line of code:
1087
1087
  #
1088
1088
  # resources :photos
@@ -142,6 +142,11 @@ module ActionDispatch
142
142
  # This will redirect the user, while ignoring certain parts of the request, including query string, etc.
143
143
  # <tt>/stories</tt>, <tt>/stories?foo=bar</tt>, etc all redirect to <tt>/posts</tt>.
144
144
  #
145
+ # The redirect will use a <tt>301 Moved Permanently</tt> status code by
146
+ # default. This can be overridden with the +:status+ option:
147
+ #
148
+ # get "/stories" => redirect("/posts", status: 307)
149
+ #
145
150
  # You can also use interpolation in the supplied redirect argument:
146
151
  #
147
152
  # get 'docs/:article', to: redirect('/wiki/%{article}')
@@ -196,7 +196,9 @@ module ActionDispatch
196
196
  def call(t, method_name, args, inner_options, url_strategy)
197
197
  if args.size == arg_size && !inner_options && optimize_routes_generation?(t)
198
198
  options = t.url_options.merge @options
199
- options[:path] = optimized_helper(args)
199
+ path = optimized_helper(args)
200
+ path << "/" if options[:trailing_slash] && !path.end_with?("/")
201
+ options[:path] = path
200
202
 
201
203
  original_script_name = options.delete(:original_script_name)
202
204
  script_name = t._routes.find_script_name(options)
@@ -70,7 +70,7 @@ module ActionDispatch
70
70
  # resources :users
71
71
  #
72
72
  # This generates, among other things, the method <tt>users_path</tt>. By default,
73
- # this method is accessible from your controllers, views and mailers. If you need
73
+ # this method is accessible from your controllers, views, and mailers. If you need
74
74
  # to access this auto-generated method from other places (such as a model), then
75
75
  # you can do that by including Rails.application.routes.url_helpers in your class:
76
76
  #
@@ -115,7 +115,7 @@ module ActionDispatch
115
115
  default_url_options
116
116
  end
117
117
 
118
- # Generate a URL based on the options provided, default_url_options and the
118
+ # Generate a URL based on the options provided, default_url_options, and the
119
119
  # routes defined in routes.rb. The following options are supported:
120
120
  #
121
121
  # * <tt>:only_path</tt> - If true, the relative URL is returned. Defaults to +false+.
@@ -154,7 +154,7 @@ module ActionDispatch
154
154
  # # => '/myapp/tasks/testing'
155
155
  #
156
156
  # Missing routes keys may be filled in from the current request's parameters
157
- # (e.g. +:controller+, +:action+, +:id+ and any other parameters that are
157
+ # (e.g. +:controller+, +:action+, +:id+, and any other parameters that are
158
158
  # placed in the path). Given that the current action has been reached
159
159
  # through <tt>GET /users/1</tt>:
160
160
  #
@@ -28,7 +28,7 @@ module ActionDispatch
28
28
  #
29
29
  # Resource routing allows you to quickly declare all of the common routes
30
30
  # for a given resourceful controller. Instead of declaring separate routes
31
- # for your +index+, +show+, +new+, +edit+, +create+, +update+ and +destroy+
31
+ # for your +index+, +show+, +new+, +edit+, +create+, +update+, and +destroy+
32
32
  # actions, a resourceful route declares them in a single line of code:
33
33
  #
34
34
  # resources :photos
@@ -65,9 +65,8 @@ module ActionDispatch
65
65
  # resources :posts, :comments
66
66
  # end
67
67
  #
68
- # For more, see <tt>Routing::Mapper::Resources#resources</tt>,
69
- # <tt>Routing::Mapper::Scoping#namespace</tt>, and
70
- # <tt>Routing::Mapper::Scoping#scope</tt>.
68
+ # For more, see Routing::Mapper::Resources#resources,
69
+ # Routing::Mapper::Scoping#namespace, and Routing::Mapper::Scoping#scope.
71
70
  #
72
71
  # == Non-resourceful routes
73
72
  #
@@ -18,8 +18,8 @@ module ActionDispatch
18
18
  # match +path+. Basically, it asserts that \Rails recognizes the route given by +expected_options+.
19
19
  #
20
20
  # Pass a hash in the second argument (+path+) to specify the request method. This is useful for routes
21
- # requiring a specific HTTP method. The hash should contain a :path with the incoming request path
22
- # and a :method containing the required HTTP verb.
21
+ # requiring a specific HTTP method. The hash should contain a +:path+ with the incoming request path
22
+ # and a +:method+ containing the required HTTP verb.
23
23
  #
24
24
  # # Asserts that POSTing to /items will call the create action on ItemsController
25
25
  # assert_recognizes({controller: 'items', action: 'create'}, {path: 'items', method: :post})
@@ -187,6 +187,7 @@ module ActionDispatch
187
187
  super
188
188
  end
189
189
  end
190
+ ruby2_keywords(:method_missing)
190
191
 
191
192
  private
192
193
  # Recognizes the route for a given path.
@@ -3,8 +3,8 @@
3
3
  require "action_dispatch/testing/request_encoder"
4
4
 
5
5
  module ActionDispatch
6
- # Integration test methods such as ActionDispatch::Integration::Session#get
7
- # and ActionDispatch::Integration::Session#post return objects of class
6
+ # Integration test methods such as Integration::RequestHelpers#get
7
+ # and Integration::RequestHelpers#post return objects of class
8
8
  # TestResponse, which represent the HTTP response results of the requested
9
9
  # controller actions.
10
10
  #
@@ -14,6 +14,24 @@ module ActionDispatch
14
14
  new response.status, response.headers, response.body
15
15
  end
16
16
 
17
+ # Returns a parsed body depending on the response MIME type. When a parser
18
+ # corresponding to the MIME type is not found, it returns the raw body.
19
+ #
20
+ # ==== Examples
21
+ # get "/posts"
22
+ # response.content_type # => "text/html; charset=utf-8"
23
+ # response.parsed_body.class # => String
24
+ # response.parsed_body # => "<!DOCTYPE html>\n<html>\n..."
25
+ #
26
+ # get "/posts.json"
27
+ # response.content_type # => "application/json; charset=utf-8"
28
+ # response.parsed_body.class # => Array
29
+ # response.parsed_body # => [{"id"=>42, "title"=>"Title"},...
30
+ #
31
+ # get "/posts/42.json"
32
+ # response.content_type # => "application/json; charset=utf-8"
33
+ # response.parsed_body.class # => Hash
34
+ # response.parsed_body # => {"id"=>42, "title"=>"Title"}
17
35
  def parsed_body
18
36
  @parsed_body ||= response_parser.call(body)
19
37
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActionPack
4
- # Returns the version of the currently loaded Action Pack as a <tt>Gem::Version</tt>
4
+ # Returns the currently loaded version of Action Pack as a <tt>Gem::Version</tt>.
5
5
  def self.gem_version
6
6
  Gem::Version.new VERSION::STRING
7
7
  end
@@ -9,8 +9,8 @@ module ActionPack
9
9
  module VERSION
10
10
  MAJOR = 7
11
11
  MINOR = 0
12
- TINY = 2
13
- PRE = "4"
12
+ TINY = 4
13
+ PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -3,7 +3,7 @@
3
3
  require_relative "gem_version"
4
4
 
5
5
  module ActionPack
6
- # Returns the version of the currently loaded ActionPack as a <tt>Gem::Version</tt>
6
+ # Returns the currently loaded version of Action Pack as a <tt>Gem::Version</tt>.
7
7
  def self.version
8
8
  gem_version
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.2.4
4
+ version: 7.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-26 00:00:00.000000000 Z
11
+ date: 2022-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 7.0.2.4
19
+ version: 7.0.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 7.0.2.4
26
+ version: 7.0.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rack
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -98,28 +98,28 @@ dependencies:
98
98
  requirements:
99
99
  - - '='
100
100
  - !ruby/object:Gem::Version
101
- version: 7.0.2.4
101
+ version: 7.0.4
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - '='
107
107
  - !ruby/object:Gem::Version
108
- version: 7.0.2.4
108
+ version: 7.0.4
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: activemodel
111
111
  requirement: !ruby/object:Gem::Requirement
112
112
  requirements:
113
113
  - - '='
114
114
  - !ruby/object:Gem::Version
115
- version: 7.0.2.4
115
+ version: 7.0.4
116
116
  type: :development
117
117
  prerelease: false
118
118
  version_requirements: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - '='
121
121
  - !ruby/object:Gem::Version
122
- version: 7.0.2.4
122
+ version: 7.0.4
123
123
  description: Web apps on Rails. Simple, battle-tested conventions for building and
124
124
  testing MVC web applications. Works with any Rack-compatible server.
125
125
  email: david@loudthinking.com
@@ -310,10 +310,10 @@ licenses:
310
310
  - MIT
311
311
  metadata:
312
312
  bug_tracker_uri: https://github.com/rails/rails/issues
313
- changelog_uri: https://github.com/rails/rails/blob/v7.0.2.4/actionpack/CHANGELOG.md
314
- documentation_uri: https://api.rubyonrails.org/v7.0.2.4/
313
+ changelog_uri: https://github.com/rails/rails/blob/v7.0.4/actionpack/CHANGELOG.md
314
+ documentation_uri: https://api.rubyonrails.org/v7.0.4/
315
315
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
316
- source_code_uri: https://github.com/rails/rails/tree/v7.0.2.4/actionpack
316
+ source_code_uri: https://github.com/rails/rails/tree/v7.0.4/actionpack
317
317
  rubygems_mfa_required: 'true'
318
318
  post_install_message:
319
319
  rdoc_options: []
@@ -331,7 +331,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
331
331
  version: '0'
332
332
  requirements:
333
333
  - none
334
- rubygems_version: 3.1.6
334
+ rubygems_version: 3.3.3
335
335
  signing_key:
336
336
  specification_version: 4
337
337
  summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).