Mastodon API: Fix lists leaking private posts
Our previous list visibility resolver grabbed posts if either follower collection of the user in a list who is followed is in `to` or if follower collection of the user in a list was in `cc`. This not only missed unlisted posts but also lead to leaking private posts when `fix_explicit_addressing` mistakingly started putting follower collections to `cc` (also fixed in this MR). Reported by @kurisu@iscute.moe via a DM
This commit is contained in:
parent
a9eaa55885
commit
d9c0650ff9
3 changed files with 44 additions and 16 deletions
|
|
@ -1186,4 +1186,33 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubTest do
|
|||
def data_uri do
|
||||
File.read!("test/fixtures/avatar_data_uri")
|
||||
end
|
||||
|
||||
describe "fetch_activities_bounded" do
|
||||
test "fetches private posts for followed users" do
|
||||
user = insert(:user)
|
||||
|
||||
{:ok, activity} =
|
||||
CommonAPI.post(user, %{
|
||||
"status" => "thought I looked cute might delete later :3",
|
||||
"visibility" => "private"
|
||||
})
|
||||
|
||||
[result] = ActivityPub.fetch_activities_bounded([user.follower_address], [])
|
||||
assert result.id == activity.id
|
||||
end
|
||||
|
||||
test "fetches only public posts for other users" do
|
||||
user = insert(:user)
|
||||
{:ok, activity} = CommonAPI.post(user, %{"status" => "#cofe", "visibility" => "public"})
|
||||
|
||||
{:ok, _private_activity} =
|
||||
CommonAPI.post(user, %{
|
||||
"status" => "why is tenshi eating a corndog so cute?",
|
||||
"visibility" => "private"
|
||||
})
|
||||
|
||||
[result] = ActivityPub.fetch_activities_bounded([], [user.follower_address])
|
||||
assert result.id == activity.id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue