Skip to content

Commit

Permalink
Merge branch '7-0-stable' into fix/webdrivers-on-7-0-stable
Browse files Browse the repository at this point in the history
  • Loading branch information
R.R authored Aug 23, 2023
2 parents 26bb652 + e478dca commit 01e6c58
Show file tree
Hide file tree
Showing 42 changed files with 5,664 additions and 5,512 deletions.
108 changes: 54 additions & 54 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -31,88 +31,88 @@ GIT
PATH
remote: .
specs:
actioncable (7.0.7)
actionpack (= 7.0.7)
activesupport (= 7.0.7)
actioncable (7.0.7.2)
actionpack (= 7.0.7.2)
activesupport (= 7.0.7.2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.7)
actionpack (= 7.0.7)
activejob (= 7.0.7)
activerecord (= 7.0.7)
activestorage (= 7.0.7)
activesupport (= 7.0.7)
actionmailbox (7.0.7.2)
actionpack (= 7.0.7.2)
activejob (= 7.0.7.2)
activerecord (= 7.0.7.2)
activestorage (= 7.0.7.2)
activesupport (= 7.0.7.2)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.7)
actionpack (= 7.0.7)
actionview (= 7.0.7)
activejob (= 7.0.7)
activesupport (= 7.0.7)
actionmailer (7.0.7.2)
actionpack (= 7.0.7.2)
actionview (= 7.0.7.2)
activejob (= 7.0.7.2)
activesupport (= 7.0.7.2)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.7)
actionview (= 7.0.7)
activesupport (= 7.0.7)
actionpack (7.0.7.2)
actionview (= 7.0.7.2)
activesupport (= 7.0.7.2)
rack (~> 2.0, >= 2.2.4)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.7)
actionpack (= 7.0.7)
activerecord (= 7.0.7)
activestorage (= 7.0.7)
activesupport (= 7.0.7)
actiontext (7.0.7.2)
actionpack (= 7.0.7.2)
activerecord (= 7.0.7.2)
activestorage (= 7.0.7.2)
activesupport (= 7.0.7.2)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.7)
activesupport (= 7.0.7)
actionview (7.0.7.2)
activesupport (= 7.0.7.2)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.7)
activesupport (= 7.0.7)
activejob (7.0.7.2)
activesupport (= 7.0.7.2)
globalid (>= 0.3.6)
activemodel (7.0.7)
activesupport (= 7.0.7)
activerecord (7.0.7)
activemodel (= 7.0.7)
activesupport (= 7.0.7)
activestorage (7.0.7)
actionpack (= 7.0.7)
activejob (= 7.0.7)
activerecord (= 7.0.7)
activesupport (= 7.0.7)
activemodel (7.0.7.2)
activesupport (= 7.0.7.2)
activerecord (7.0.7.2)
activemodel (= 7.0.7.2)
activesupport (= 7.0.7.2)
activestorage (7.0.7.2)
actionpack (= 7.0.7.2)
activejob (= 7.0.7.2)
activerecord (= 7.0.7.2)
activesupport (= 7.0.7.2)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.7)
activesupport (7.0.7.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
rails (7.0.7)
actioncable (= 7.0.7)
actionmailbox (= 7.0.7)
actionmailer (= 7.0.7)
actionpack (= 7.0.7)
actiontext (= 7.0.7)
actionview (= 7.0.7)
activejob (= 7.0.7)
activemodel (= 7.0.7)
activerecord (= 7.0.7)
activestorage (= 7.0.7)
activesupport (= 7.0.7)
rails (7.0.7.2)
actioncable (= 7.0.7.2)
actionmailbox (= 7.0.7.2)
actionmailer (= 7.0.7.2)
actionpack (= 7.0.7.2)
actiontext (= 7.0.7.2)
actionview (= 7.0.7.2)
activejob (= 7.0.7.2)
activemodel (= 7.0.7.2)
activerecord (= 7.0.7.2)
activestorage (= 7.0.7.2)
activesupport (= 7.0.7.2)
bundler (>= 1.15.0)
railties (= 7.0.7)
railties (7.0.7)
actionpack (= 7.0.7)
activesupport (= 7.0.7)
railties (= 7.0.7.2)
railties (7.0.7.2)
actionpack (= 7.0.7.2)
activesupport (= 7.0.7.2)
method_source
rake (>= 12.2)
thor (~> 1.0)
Expand Down Expand Up @@ -567,7 +567,7 @@ GEM
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.8)
zeitwerk (2.6.11)

PLATFORMS
ruby
Expand Down
2 changes: 1 addition & 1 deletion RAILS_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.0.7
7.0.7.2
10 changes: 10 additions & 0 deletions actioncable/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## Rails 7.0.7.2 (August 22, 2023) ##

* No changes.


## Rails 7.0.7.1 (August 22, 2023) ##

* No changes.


## Rails 7.0.7 (August 09, 2023) ##

* No changes.
Expand Down
2 changes: 1 addition & 1 deletion actioncable/lib/action_cable/gem_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module VERSION
MAJOR = 7
MINOR = 0
TINY = 7
PRE = nil
PRE = "2"

STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end
Expand Down
2 changes: 1 addition & 1 deletion actioncable/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rails/actioncable",
"version": "7.0.7",
"version": "7.0.7-2",
"description": "WebSocket framework for Ruby on Rails.",
"module": "app/assets/javascripts/actioncable.esm.js",
"main": "app/assets/javascripts/actioncable.js",
Expand Down
10 changes: 10 additions & 0 deletions actionmailbox/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## Rails 7.0.7.2 (August 22, 2023) ##

* No changes.


## Rails 7.0.7.1 (August 22, 2023) ##

* No changes.


## Rails 7.0.7 (August 09, 2023) ##

* No changes.
Expand Down
2 changes: 1 addition & 1 deletion actionmailbox/lib/action_mailbox/gem_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module VERSION
MAJOR = 7
MINOR = 0
TINY = 7
PRE = nil
PRE = "2"

STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end
Expand Down
10 changes: 10 additions & 0 deletions actionmailer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## Rails 7.0.7.2 (August 22, 2023) ##

* No changes.


## Rails 7.0.7.1 (August 22, 2023) ##

* No changes.


## Rails 7.0.7 (August 09, 2023) ##

* No changes.
Expand Down
2 changes: 1 addition & 1 deletion actionmailer/lib/action_mailer/gem_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module VERSION
MAJOR = 7
MINOR = 0
TINY = 7
PRE = nil
PRE = "2"

STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end
Expand Down
16 changes: 16 additions & 0 deletions actionpack/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
* Fix `HostAuthorization` potentially displaying the value of the
X_FORWARDED_HOST header when the HTTP_HOST header is being blocked.

*Hartley McGuire*, *Daniel Schlosser*


## Rails 7.0.7.2 (August 22, 2023) ##

* No changes.


## Rails 7.0.7.1 (August 22, 2023) ##

* No changes.


## Rails 7.0.7 (August 09, 2023) ##

* No changes.
Expand Down
17 changes: 12 additions & 5 deletions actionpack/lib/action_dispatch/middleware/host_authorization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def call(env)
def response_body(request)
return "" unless request.get_header("action_dispatch.show_detailed_exceptions")

template = DebugView.new(host: request.host)
template = DebugView.new(hosts: request.env["action_dispatch.blocked_hosts"])
template.render(template: "rescues/blocked_host", layout: "rescues/layout")
end

Expand All @@ -111,7 +111,7 @@ def log_error(request)

return unless logger

logger.error("[#{self.class.name}] Blocked host: #{request.host}")
logger.error("[#{self.class.name}] Blocked hosts: #{request.env["action_dispatch.blocked_hosts"].join(", ")}")
end

def available_logger(request)
Expand All @@ -131,21 +131,28 @@ def call(env)
return @app.call(env) if @permissions.empty?

request = Request.new(env)
hosts = blocked_hosts(request)

if authorized?(request) || excluded?(request)
if hosts.empty? || excluded?(request)
mark_as_authorized(request)
@app.call(env)
else
env["action_dispatch.blocked_hosts"] = hosts
@response_app.call(env)
end
end

private
def authorized?(request)
def blocked_hosts(request)
hosts = []

origin_host = request.get_header("HTTP_HOST")
hosts << origin_host unless @permissions.allows?(origin_host)

forwarded_host = request.x_forwarded_host&.split(/,\s?/)&.last
hosts << forwarded_host unless forwarded_host.blank? || @permissions.allows?(forwarded_host)

@permissions.allows?(origin_host) && (forwarded_host.blank? || @permissions.allows?(forwarded_host))
hosts
end

def excluded?(request)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<header>
<h1>Blocked host: <%= @host %></h1>
<h1>Blocked hosts: <%= @hosts.join(", ") %></h1>
</header>
<main role="main" id="container">
<h2>To allow requests to <%= @host %> make sure it is a valid hostname (containing only numbers, letters, dashes and dots), then add the following to your environment configuration:</h2>
<pre>config.hosts &lt;&lt; "<%= @host %>"</pre>
<h2>To allow requests to these hosts, make sure they are valid hostnames (containing only numbers, letters, dashes and dots), then add the following to your environment configuration:</h2>
<pre>
<% @hosts.each do |host| %>
config.hosts &lt;&lt; "<%= host %>"
<% end %>
</pre>
<p>For more details view: <a href="https://guides.rubyonrails.org/configuring.html#actiondispatch-hostauthorization">the Host Authorization guide</a></p>
</main>
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
Blocked host: <%= @host %>
Blocked hosts: <%= @hosts.join(", ") %>

To allow requests to <%= @host %> make sure it is a valid hostname (containing only numbers, letters, dashes and dots), then add the following to your environment configuration:
To allow requests to these hosts, make sure they are valid hostnames (containing only numbers, letters, dashes and dots), then add the following to your environment configuration:

config.hosts << "<%= @host %>"
<% @hosts.each do |host| %>
config.hosts << "<%= host %>"
<% end %>

For more details on host authorization view: https://guides.rubyonrails.org/configuring.html#actiondispatch-hostauthorization
2 changes: 1 addition & 1 deletion actionpack/lib/action_pack/gem_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module VERSION
MAJOR = 7
MINOR = 0
TINY = 7
PRE = nil
PRE = "2"

STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end
Expand Down
Loading

0 comments on commit 01e6c58

Please sign in to comment.