mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
SECURITY: Users can only bookmark posts which they can see.
This commit is contained in:
@@ -1255,6 +1255,15 @@ describe TopicsController do
|
||||
xhr :put, :remove_bookmarks, topic_id: post.topic_id
|
||||
expect(PostAction.where(user_id: user.id, post_action_type: bookmark).count).to eq(0)
|
||||
end
|
||||
|
||||
it "should disallow bookmarks on posts you have no access to" do
|
||||
log_in
|
||||
user = Fabricate(:user)
|
||||
pm = create_post(user: user, archetype: 'private_message', target_usernames: [user.username])
|
||||
|
||||
xhr :put, :bookmark, topic_id: pm.topic_id
|
||||
expect(response).to be_forbidden
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user