actionpack 6.0.4.3 → 6.0.4.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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4204052bc97219a103dc4fb43f06e381046d4ea1baf271d5b1223117996b0618
4
- data.tar.gz: 7e78d49b9b56c77363b612e99ccccd467b079b45db0f66139b7f6b7ace5ab516
3
+ metadata.gz: 77d0c31e55cac2f1197378000339e0def3f018ab55493703905c3fb3969e7625
4
+ data.tar.gz: 645430d4e7b0515b72ca93abdca82c4f3bc95840e4e51d2766af835013d4815b
5
5
  SHA512:
6
- metadata.gz: aeaa2c82e04fefe226a7b9fe789e1e306621ea54a1a3b92fca5cff2eb9e5d1fe9d16f73d23bb56942359fe6c3a6a8e5f242e778f7e22e381a53c229148ea4ef2
7
- data.tar.gz: 36c20a636261420bd253b3ec129360c5cac2ccadebaff547634d2ca319911f9a55addea03ea1b99d3dacd636cc205c52103b138ba635b470c6de0c04946ca063
6
+ metadata.gz: 9354a9e8747dfc352e007f1f6218abd5ea2518ea60d249b2d84b9499c5edfca3a198a2ee0217acd39cc4b858eef76abdbc73a68b761dfc97a2a5b70c69b3b6aa
7
+ data.tar.gz: 1002a36a0686363c1f585cd5827240ad772d22079d63c02755c18c18dc1bebd9f31c24471d2a9da4c46d3eada96d61edcbc300be016042b1180c40fd61f59fc2
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
+ ## Rails 6.0.4.4 (December 15, 2021) ##
2
+
3
+ * Fix issue with host protection not allowing host with port in development.
4
+
5
+
1
6
  ## Rails 6.0.4.3 (December 14, 2021) ##
2
7
 
3
- * No changes.
8
+ * Fix issue with host protection not allowing localhost in development.
4
9
 
5
10
 
6
11
  ## Rails 6.0.4.2 (December 14, 2021) ##
@@ -10,7 +10,16 @@ module ActionDispatch
10
10
  # application will be executed and rendered. If no +response_app+ is given, a
11
11
  # default one will run, which responds with +403 Forbidden+.
12
12
  class HostAuthorization
13
- ALLOWED_HOSTS_IN_DEVELOPMENT = [".localhost", /\A([a-z0-9-]+\.)?localhost:\d+\z/, IPAddr.new("0.0.0.0/0"), IPAddr.new("::/0")]
13
+ ALLOWED_HOSTS_IN_DEVELOPMENT = [".localhost", IPAddr.new("0.0.0.0/0"), IPAddr.new("::/0")]
14
+ PORT_REGEX = /(?::\d+)/ # :nodoc:
15
+ IPV4_HOSTNAME = /(?<host>\d+\.\d+\.\d+\.\d+)#{PORT_REGEX}?/ # :nodoc:
16
+ IPV6_HOSTNAME = /(?<host>[a-f0-9]*:[a-f0-9.:]+)/i # :nodoc:
17
+ IPV6_HOSTNAME_WITH_PORT = /\[#{IPV6_HOSTNAME}\]#{PORT_REGEX}/i # :nodoc:
18
+ VALID_IP_HOSTNAME = Regexp.union( # :nodoc:
19
+ /\A#{IPV4_HOSTNAME}\z/,
20
+ /\A#{IPV6_HOSTNAME}\z/,
21
+ /\A#{IPV6_HOSTNAME_WITH_PORT}\z/,
22
+ )
14
23
 
15
24
  class Permissions # :nodoc:
16
25
  def initialize(hosts)
@@ -23,11 +32,17 @@ module ActionDispatch
23
32
 
24
33
  def allows?(host)
25
34
  @hosts.any? do |allowed|
26
- allowed === host
27
- rescue
28
- # IPAddr#=== raises an error if you give it a hostname instead of
29
- # IP. Treat similar errors as blocked access.
30
- false
35
+ if allowed.is_a?(IPAddr)
36
+ begin
37
+ allowed === extract_hostname(host)
38
+ rescue
39
+ # IPAddr#=== raises an error if you give it a hostname instead of
40
+ # IP. Treat similar errors as blocked access.
41
+ false
42
+ end
43
+ else
44
+ allowed === host
45
+ end
31
46
  end
32
47
  end
33
48
 
@@ -43,16 +58,20 @@ module ActionDispatch
43
58
  end
44
59
 
45
60
  def sanitize_regexp(host)
46
- /\A#{host}\z/
61
+ /\A#{host}#{PORT_REGEX}?\z/
47
62
  end
48
63
 
49
64
  def sanitize_string(host)
50
65
  if host.start_with?(".")
51
- /\A([a-z0-9-]+\.)?#{Regexp.escape(host[1..-1])}\z/i
66
+ /\A([a-z0-9-]+\.)?#{Regexp.escape(host[1..-1])}#{PORT_REGEX}?\z/i
52
67
  else
53
- /\A#{Regexp.escape host}\z/i
68
+ /\A#{Regexp.escape host}#{PORT_REGEX}?\z/i
54
69
  end
55
70
  end
71
+
72
+ def extract_hostname(host)
73
+ host.slice(VALID_IP_HOSTNAME, "host") || host
74
+ end
56
75
  end
57
76
 
58
77
  DEFAULT_RESPONSE_APP = -> env do
@@ -10,7 +10,7 @@ module ActionPack
10
10
  MAJOR = 6
11
11
  MINOR = 0
12
12
  TINY = 4
13
- PRE = "3"
13
+ PRE = "4"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  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: 6.0.4.3
4
+ version: 6.0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-14 00:00:00.000000000 Z
11
+ date: 2021-12-15 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: 6.0.4.3
19
+ version: 6.0.4.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: 6.0.4.3
26
+ version: 6.0.4.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: 6.0.4.3
101
+ version: 6.0.4.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: 6.0.4.3
108
+ version: 6.0.4.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: 6.0.4.3
115
+ version: 6.0.4.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: 6.0.4.3
122
+ version: 6.0.4.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,11 +310,11 @@ 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/v6.0.4.3/actionpack/CHANGELOG.md
314
- documentation_uri: https://api.rubyonrails.org/v6.0.4.3/
313
+ changelog_uri: https://github.com/rails/rails/blob/v6.0.4.4/actionpack/CHANGELOG.md
314
+ documentation_uri: https://api.rubyonrails.org/v6.0.4.4/
315
315
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
316
- source_code_uri: https://github.com/rails/rails/tree/v6.0.4.3/actionpack
317
- post_install_message:
316
+ source_code_uri: https://github.com/rails/rails/tree/v6.0.4.4/actionpack
317
+ post_install_message:
318
318
  rdoc_options: []
319
319
  require_paths:
320
320
  - lib
@@ -330,8 +330,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
330
330
  version: '0'
331
331
  requirements:
332
332
  - none
333
- rubygems_version: 3.2.15
334
- signing_key:
333
+ rubygems_version: 3.2.32
334
+ signing_key:
335
335
  specification_version: 4
336
336
  summary: Web-flow and rendering framework putting the VC in MVC (part of Rails).
337
337
  test_files: []