mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 23:36:11 +08:00
SECURITY: Don't allow redirects with periods in case you don't control
other tlds on the same domain.
This commit is contained in:
@ -65,7 +65,9 @@ class StaticController < ApplicationController
|
||||
begin
|
||||
forum_uri = URI(Discourse.base_url)
|
||||
uri = URI(params[:redirect])
|
||||
if uri.path.present? && (uri.host.blank? || uri.host == forum_uri.host)
|
||||
if uri.path.present? &&
|
||||
(uri.host.blank? || uri.host == forum_uri.host) &&
|
||||
uri.path !~ /\./
|
||||
destination = uri.path
|
||||
end
|
||||
rescue URI::InvalidURIError
|
||||
|
Reference in New Issue
Block a user