SECURITY: Don't allow redirects with periods in case you don't control

other tlds on the same domain.
This commit is contained in:
Robin Ward
2014-10-30 11:31:44 -04:00
parent 59cc2476a1
commit 316f1bea04
2 changed files with 10 additions and 1 deletions

View File

@ -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