SECURITY: do not disclose topic titles on /unsubscribed page to unauthorized users

This commit is contained in:
Arpit Jalan 2018-04-15 17:59:58 +05:30
parent 0bf1c476d7
commit 411696b85e

View File

@ -110,8 +110,10 @@ class EmailController < ApplicationController
def unsubscribed def unsubscribed
@email = params[:email] @email = params[:email]
raise Discourse::NotFound if !User.find_by_email(params[:email]) user = User.find_by_email(params[:email])
raise Discourse::NotFound unless user
@topic = Topic.find_by(id: params[:topic_id].to_i) if params[:topic_id] @topic = Topic.find_by(id: params[:topic_id].to_i) if params[:topic_id]
raise Discourse::NotFound unless Guardian.new(user).can_see?(@topic)
end end
end end