mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:34:31 +08:00
SECURITY: Don't leak topic title in the redirect
This commit is contained in:
@ -821,4 +821,19 @@ describe PostsController do
|
||||
end
|
||||
end
|
||||
|
||||
describe "short link" do
|
||||
let(:topic) { Fabricate(:topic) }
|
||||
let(:post) { Fabricate(:post, topic: topic) }
|
||||
|
||||
it "redirects to the topic" do
|
||||
xhr :get, :short_link, post_id: post.id
|
||||
response.should be_redirect
|
||||
end
|
||||
|
||||
it "returns a 403 when access is denied" do
|
||||
Guardian.any_instance.stubs(:can_see?).returns(false)
|
||||
xhr :get, :short_link, post_id: post.id
|
||||
response.should be_forbidden
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user