actionpack 5.2.0 → 5.2.1.rc1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +55 -0
- data/lib/action_controller/metal/request_forgery_protection.rb +1 -1
- data/lib/action_controller/metal/strong_parameters.rb +14 -13
- data/lib/action_controller/test_case.rb +6 -4
- data/lib/action_dispatch/http/content_security_policy.rb +20 -13
- data/lib/action_dispatch/journey/routes.rb +2 -1
- data/lib/action_dispatch/middleware/flash.rb +1 -1
- data/lib/action_dispatch/middleware/static.rb +5 -5
- data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb +1 -1
- data/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb +1 -1
- data/lib/action_dispatch/routing/mapper.rb +2 -1
- data/lib/action_dispatch/routing/url_for.rb +1 -1
- data/lib/action_dispatch/system_test_case.rb +1 -1
- data/lib/action_dispatch/system_testing/browser.rb +1 -1
- data/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb +1 -0
- data/lib/action_dispatch/testing/request_encoder.rb +1 -1
- data/lib/action_pack/gem_version.rb +2 -2
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64edb9594a9442de350c820f190ba694bad46fc2b326ddd91e30a48d09879a6d
|
4
|
+
data.tar.gz: dff86b8fc14dba0af55290f1af2c205d0491ce32ce8ab23c164ec99a34e4756f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 582f4a5f98828afc8026dd93d5a173a2afd22c65839dda2c16009fcf118a3a53f2c82f2cbd20360fc6ca31d3da77d6fe9915b29497084a78de7671d3b23d735a
|
7
|
+
data.tar.gz: 89d4b50b7c3f4dabbd5348bbd75687579838e182a5ecbf621a4d40d6605aa784f240f2a095931a77ef99be5c1a79bad315c3944ea0abf96804161a254ca25b8f
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,58 @@
|
|
1
|
+
## Rails 5.2.1.rc1 (July 30, 2018) ##
|
2
|
+
|
3
|
+
* Prevent `?null=` being passed on JSON encoded test requests.
|
4
|
+
|
5
|
+
`RequestEncoder#encode_params` won't attempt to parse params if
|
6
|
+
there are none.
|
7
|
+
|
8
|
+
So call like this will no longer append a `?null=` query param.
|
9
|
+
|
10
|
+
get foos_url, as: :json
|
11
|
+
|
12
|
+
*Alireza Bashiri*
|
13
|
+
|
14
|
+
* Ensure `ActionController::Parameters#transform_values` and
|
15
|
+
`ActionController::Parameters#transform_values!` converts hashes into
|
16
|
+
parameters.
|
17
|
+
|
18
|
+
*Kevin Sjöberg*
|
19
|
+
|
20
|
+
* Fix strong parameters `permit!` with nested arrays.
|
21
|
+
|
22
|
+
Given:
|
23
|
+
```
|
24
|
+
params = ActionController::Parameters.new(nested_arrays: [[{ x: 2, y: 3 }, { x: 21, y: 42 }]])
|
25
|
+
params.permit!
|
26
|
+
```
|
27
|
+
|
28
|
+
`params[:nested_arrays][0][0].permitted?` will now return `true` instead of `false`.
|
29
|
+
|
30
|
+
*Steve Hull*
|
31
|
+
|
32
|
+
* Reset `RAW_POST_DATA` and `CONTENT_LENGTH` request environment between test requests in
|
33
|
+
`ActionController::TestCase` subclasses.
|
34
|
+
|
35
|
+
*Eugene Kenny*
|
36
|
+
|
37
|
+
* Output only one Content-Security-Policy nonce header value per request.
|
38
|
+
|
39
|
+
Fixes #32597.
|
40
|
+
|
41
|
+
*Andrey Novikov*, *Andrew White*
|
42
|
+
|
43
|
+
* Only disable GPUs for headless Chrome on Windows.
|
44
|
+
|
45
|
+
It is not necessary anymore for Linux and macOS machines.
|
46
|
+
|
47
|
+
https://bugs.chromium.org/p/chromium/issues/detail?id=737678#c1
|
48
|
+
|
49
|
+
*Stefan Wrobel*
|
50
|
+
|
51
|
+
* Fix system tests transactions not closed between examples.
|
52
|
+
|
53
|
+
*Sergey Tarasov*
|
54
|
+
|
55
|
+
|
1
56
|
## Rails 5.2.0 (April 09, 2018) ##
|
2
57
|
|
3
58
|
* Check exclude before flagging cookies as secure.
|
@@ -418,7 +418,7 @@ module ActionController #:nodoc:
|
|
418
418
|
|
419
419
|
NULL_ORIGIN_MESSAGE = <<-MSG.strip_heredoc
|
420
420
|
The browser returned a 'null' origin for a request with origin-based forgery protection turned on. This usually
|
421
|
-
means you have the 'no-referrer' Referrer-Policy header enabled, or that
|
421
|
+
means you have the 'no-referrer' Referrer-Policy header enabled, or that the request came from a site that
|
422
422
|
refused to give its origin. This makes it impossible for Rails to verify the source of the requests. Likely the
|
423
423
|
best solution is to change your referrer policy to something less strict like same-origin or strict-same-origin.
|
424
424
|
If you cannot change the referrer policy, you can disable origin checking with the
|
@@ -375,7 +375,7 @@ module ActionController
|
|
375
375
|
# Person.new(params) # => #<Person id: nil, name: "Francesco">
|
376
376
|
def permit!
|
377
377
|
each_pair do |key, value|
|
378
|
-
Array.wrap(value).each do |v|
|
378
|
+
Array.wrap(value).flatten.each do |v|
|
379
379
|
v.permit! if v.respond_to? :permit!
|
380
380
|
end
|
381
381
|
end
|
@@ -561,12 +561,14 @@ module ActionController
|
|
561
561
|
# Returns a parameter for the given +key+. If the +key+
|
562
562
|
# can't be found, there are several options: With no other arguments,
|
563
563
|
# it will raise an <tt>ActionController::ParameterMissing</tt> error;
|
564
|
-
# if
|
564
|
+
# if a second argument is given, then that is returned (converted to an
|
565
|
+
# instance of ActionController::Parameters if possible); if a block
|
565
566
|
# is given, then that will be run and its result returned.
|
566
567
|
#
|
567
568
|
# params = ActionController::Parameters.new(person: { name: "Francesco" })
|
568
569
|
# params.fetch(:person) # => <ActionController::Parameters {"name"=>"Francesco"} permitted: false>
|
569
570
|
# params.fetch(:none) # => ActionController::ParameterMissing: param is missing or the value is empty: none
|
571
|
+
# params.fetch(:none, {}) # => <ActionController::Parameters {} permitted: false>
|
570
572
|
# params.fetch(:none, "Francesco") # => "Francesco"
|
571
573
|
# params.fetch(:none) { "Francesco" } # => "Francesco"
|
572
574
|
def fetch(key, *args)
|
@@ -592,7 +594,8 @@ module ActionController
|
|
592
594
|
# params2 = ActionController::Parameters.new(foo: [10, 11, 12])
|
593
595
|
# params2.dig(:foo, 1) # => 11
|
594
596
|
def dig(*keys)
|
595
|
-
|
597
|
+
convert_hashes_to_parameters(keys.first, @parameters[keys.first])
|
598
|
+
@parameters.dig(*keys)
|
596
599
|
end
|
597
600
|
end
|
598
601
|
|
@@ -639,20 +642,18 @@ module ActionController
|
|
639
642
|
# params = ActionController::Parameters.new(a: 1, b: 2, c: 3)
|
640
643
|
# params.transform_values { |x| x * 2 }
|
641
644
|
# # => <ActionController::Parameters {"a"=>2, "b"=>4, "c"=>6} permitted: false>
|
642
|
-
def transform_values
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
else
|
648
|
-
@parameters.transform_values
|
649
|
-
end
|
645
|
+
def transform_values
|
646
|
+
return to_enum(:transform_values) unless block_given?
|
647
|
+
new_instance_with_inherited_permitted_status(
|
648
|
+
@parameters.transform_values { |v| yield convert_value_to_parameters(v) }
|
649
|
+
)
|
650
650
|
end
|
651
651
|
|
652
652
|
# Performs values transformation and returns the altered
|
653
653
|
# <tt>ActionController::Parameters</tt> instance.
|
654
|
-
def transform_values!
|
655
|
-
|
654
|
+
def transform_values!
|
655
|
+
return to_enum(:transform_values!) unless block_given?
|
656
|
+
@parameters.transform_values! { |v| yield convert_value_to_parameters(v) }
|
656
657
|
self
|
657
658
|
end
|
658
659
|
|
@@ -460,10 +460,6 @@ module ActionController
|
|
460
460
|
def process(action, method: "GET", params: {}, session: nil, body: nil, flash: {}, format: nil, xhr: false, as: nil)
|
461
461
|
check_required_ivars
|
462
462
|
|
463
|
-
if body
|
464
|
-
@request.set_header "RAW_POST_DATA", body
|
465
|
-
end
|
466
|
-
|
467
463
|
http_method = method.to_s.upcase
|
468
464
|
|
469
465
|
@html_document = nil
|
@@ -478,6 +474,10 @@ module ActionController
|
|
478
474
|
@response.request = @request
|
479
475
|
@controller.recycle!
|
480
476
|
|
477
|
+
if body
|
478
|
+
@request.set_header "RAW_POST_DATA", body
|
479
|
+
end
|
480
|
+
|
481
481
|
@request.set_header "REQUEST_METHOD", http_method
|
482
482
|
|
483
483
|
if as
|
@@ -604,6 +604,8 @@ module ActionController
|
|
604
604
|
env.delete "action_dispatch.request.query_parameters"
|
605
605
|
env.delete "action_dispatch.request.request_parameters"
|
606
606
|
env["rack.input"] = StringIO.new
|
607
|
+
env.delete "CONTENT_LENGTH"
|
608
|
+
env.delete "RAW_POST_DATA"
|
607
609
|
env
|
608
610
|
end
|
609
611
|
|
@@ -21,13 +21,8 @@ module ActionDispatch #:nodoc:
|
|
21
21
|
return response if policy_present?(headers)
|
22
22
|
|
23
23
|
if policy = request.content_security_policy
|
24
|
-
|
25
|
-
|
26
|
-
policy.directives["script-src"] << "'nonce-#{nonce}'"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
headers[header_name(request)] = policy.build(request.controller_instance)
|
24
|
+
nonce = request.content_security_policy_nonce
|
25
|
+
headers[header_name(request)] = policy.build(request.controller_instance, nonce)
|
31
26
|
end
|
32
27
|
|
33
28
|
response
|
@@ -113,7 +108,9 @@ module ActionDispatch #:nodoc:
|
|
113
108
|
blob: "blob:",
|
114
109
|
filesystem: "filesystem:",
|
115
110
|
report_sample: "'report-sample'",
|
116
|
-
strict_dynamic: "'strict-dynamic'"
|
111
|
+
strict_dynamic: "'strict-dynamic'",
|
112
|
+
ws: "ws:",
|
113
|
+
wss: "wss:"
|
117
114
|
}.freeze
|
118
115
|
|
119
116
|
DIRECTIVES = {
|
@@ -134,7 +131,9 @@ module ActionDispatch #:nodoc:
|
|
134
131
|
worker_src: "worker-src"
|
135
132
|
}.freeze
|
136
133
|
|
137
|
-
|
134
|
+
NONCE_DIRECTIVES = %w[script-src].freeze
|
135
|
+
|
136
|
+
private_constant :MAPPINGS, :DIRECTIVES, :NONCE_DIRECTIVES
|
138
137
|
|
139
138
|
attr_reader :directives
|
140
139
|
|
@@ -203,8 +202,8 @@ module ActionDispatch #:nodoc:
|
|
203
202
|
end
|
204
203
|
end
|
205
204
|
|
206
|
-
def build(context = nil)
|
207
|
-
build_directives(context).compact.join("; ")
|
205
|
+
def build(context = nil, nonce = nil)
|
206
|
+
build_directives(context, nonce).compact.join("; ")
|
208
207
|
end
|
209
208
|
|
210
209
|
private
|
@@ -227,10 +226,14 @@ module ActionDispatch #:nodoc:
|
|
227
226
|
end
|
228
227
|
end
|
229
228
|
|
230
|
-
def build_directives(context)
|
229
|
+
def build_directives(context, nonce)
|
231
230
|
@directives.map do |directive, sources|
|
232
231
|
if sources.is_a?(Array)
|
233
|
-
|
232
|
+
if nonce && nonce_directive?(directive)
|
233
|
+
"#{directive} #{build_directive(sources, context).join(' ')} 'nonce-#{nonce}'"
|
234
|
+
else
|
235
|
+
"#{directive} #{build_directive(sources, context).join(' ')}"
|
236
|
+
end
|
234
237
|
elsif sources
|
235
238
|
directive
|
236
239
|
else
|
@@ -259,5 +262,9 @@ module ActionDispatch #:nodoc:
|
|
259
262
|
raise RuntimeError, "Unexpected content security policy source: #{source.inspect}"
|
260
263
|
end
|
261
264
|
end
|
265
|
+
|
266
|
+
def nonce_directive?(directive)
|
267
|
+
NONCE_DIRECTIVES.include?(directive)
|
268
|
+
end
|
262
269
|
end
|
263
270
|
end
|
@@ -51,11 +51,12 @@ module ActionDispatch
|
|
51
51
|
def ast
|
52
52
|
@ast ||= begin
|
53
53
|
asts = anchored_routes.map(&:ast)
|
54
|
-
Nodes::Or.new(asts)
|
54
|
+
Nodes::Or.new(asts)
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
58
|
def simulator
|
59
|
+
return if ast.nil?
|
59
60
|
@simulator ||= begin
|
60
61
|
gtg = GTG::Builder.new(ast).transition_table
|
61
62
|
GTG::Simulator.new(gtg)
|
@@ -16,7 +16,7 @@ module ActionDispatch
|
|
16
16
|
# does not exist, a 404 "File not Found" response will be returned.
|
17
17
|
class FileHandler
|
18
18
|
def initialize(root, index: "index", headers: {})
|
19
|
-
@root = root.chomp("/")
|
19
|
+
@root = root.chomp("/").b
|
20
20
|
@file_server = ::Rack::File.new(@root, headers)
|
21
21
|
@index = index
|
22
22
|
end
|
@@ -35,7 +35,7 @@ module ActionDispatch
|
|
35
35
|
paths = [path, "#{path}#{ext}", "#{path}/#{@index}#{ext}"]
|
36
36
|
|
37
37
|
if match = paths.detect { |p|
|
38
|
-
path = File.join(@root, p.
|
38
|
+
path = File.join(@root, p.b)
|
39
39
|
begin
|
40
40
|
File.file?(path) && File.readable?(path)
|
41
41
|
rescue SystemCallError
|
@@ -43,7 +43,7 @@ module ActionDispatch
|
|
43
43
|
end
|
44
44
|
|
45
45
|
}
|
46
|
-
return ::Rack::Utils.escape_path(match)
|
46
|
+
return ::Rack::Utils.escape_path(match).b
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -90,8 +90,8 @@ module ActionDispatch
|
|
90
90
|
def gzip_file_path(path)
|
91
91
|
can_gzip_mime = content_type(path) =~ /\A(?:text\/|application\/javascript)/
|
92
92
|
gzip_path = "#{path}.gz"
|
93
|
-
if can_gzip_mime && File.exist?(File.join(@root, ::Rack::Utils.unescape_path(gzip_path)))
|
94
|
-
gzip_path
|
93
|
+
if can_gzip_mime && File.exist?(File.join(@root, ::Rack::Utils.unescape_path(gzip_path).b))
|
94
|
+
gzip_path.b
|
95
95
|
else
|
96
96
|
false
|
97
97
|
end
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<div id="container">
|
11
11
|
<h2>
|
12
12
|
<%= h @exception.message %>
|
13
|
-
<% if
|
13
|
+
<% if %r{#{ActiveStorage::Blob.table_name}|#{ActiveStorage::Attachment.table_name}}.match?(@exception.message) %>
|
14
14
|
<br />To resolve this issue run: bin/rails active_storage:install
|
15
15
|
<% end %>
|
16
16
|
</h2>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<% end %>
|
5
5
|
|
6
6
|
<%= @exception.message %>
|
7
|
-
<% if
|
7
|
+
<% if %r{#{ActiveStorage::Blob.table_name}|#{ActiveStorage::Attachment.table_name}}.match?(@exception.message) %>
|
8
8
|
To resolve this issue run: bin/rails active_storage:install
|
9
9
|
<% end %>
|
10
10
|
|
@@ -664,6 +664,7 @@ module ActionDispatch
|
|
664
664
|
def define_generate_prefix(app, name)
|
665
665
|
_route = @set.named_routes.get name
|
666
666
|
_routes = @set
|
667
|
+
_url_helpers = @set.url_helpers
|
667
668
|
|
668
669
|
script_namer = ->(options) do
|
669
670
|
prefix_options = options.slice(*_route.segment_keys)
|
@@ -675,7 +676,7 @@ module ActionDispatch
|
|
675
676
|
|
676
677
|
# We must actually delete prefix segment keys to avoid passing them to next url_for.
|
677
678
|
_route.segment_keys.each { |k| options.delete(k) }
|
678
|
-
|
679
|
+
_url_helpers.send("#{name}_path", prefix_options)
|
679
680
|
end
|
680
681
|
|
681
682
|
app.routes.define_mounted_helper(name, script_namer)
|
@@ -204,7 +204,7 @@ module ActionDispatch
|
|
204
204
|
# end
|
205
205
|
#
|
206
206
|
# This maintains the context of the original caller on
|
207
|
-
# whether to return a path or full
|
207
|
+
# whether to return a path or full URL, e.g:
|
208
208
|
#
|
209
209
|
# threadable_path(threadable) # => "/buckets/1"
|
210
210
|
# threadable_url(threadable) # => "http://example.com/buckets/1"
|
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: 5.2.
|
4
|
+
version: 5.2.1.rc1
|
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: 2018-
|
11
|
+
date: 2018-07-30 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: 5.2.
|
19
|
+
version: 5.2.1.rc1
|
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: 5.2.
|
26
|
+
version: 5.2.1.rc1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,28 +92,28 @@ dependencies:
|
|
92
92
|
requirements:
|
93
93
|
- - '='
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: 5.2.
|
95
|
+
version: 5.2.1.rc1
|
96
96
|
type: :runtime
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - '='
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: 5.2.
|
102
|
+
version: 5.2.1.rc1
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: activemodel
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - '='
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 5.2.
|
109
|
+
version: 5.2.1.rc1
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - '='
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: 5.2.
|
116
|
+
version: 5.2.1.rc1
|
117
117
|
description: Web apps on Rails. Simple, battle-tested conventions for building and
|
118
118
|
testing MVC web applications. Works with any Rack-compatible server.
|
119
119
|
email: david@loudthinking.com
|
@@ -293,8 +293,8 @@ homepage: http://rubyonrails.org
|
|
293
293
|
licenses:
|
294
294
|
- MIT
|
295
295
|
metadata:
|
296
|
-
source_code_uri: https://github.com/rails/rails/tree/v5.2.
|
297
|
-
changelog_uri: https://github.com/rails/rails/blob/v5.2.
|
296
|
+
source_code_uri: https://github.com/rails/rails/tree/v5.2.1.rc1/actionpack
|
297
|
+
changelog_uri: https://github.com/rails/rails/blob/v5.2.1.rc1/actionpack/CHANGELOG.md
|
298
298
|
post_install_message:
|
299
299
|
rdoc_options: []
|
300
300
|
require_paths:
|
@@ -306,13 +306,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
306
306
|
version: 2.2.2
|
307
307
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
308
308
|
requirements:
|
309
|
-
- - "
|
309
|
+
- - ">"
|
310
310
|
- !ruby/object:Gem::Version
|
311
|
-
version:
|
311
|
+
version: 1.3.1
|
312
312
|
requirements:
|
313
313
|
- none
|
314
314
|
rubyforge_project:
|
315
|
-
rubygems_version: 2.7.
|
315
|
+
rubygems_version: 2.7.3
|
316
316
|
signing_key:
|
317
317
|
specification_version: 4
|
318
318
|
summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).
|