mastodon api: use bounded AP object graph query to enforce containment of private...
authorWilliam Pitcock <nenolod@dereferenced.org>
Wed, 29 Aug 2018 08:51:51 +0000 (08:51 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Wed, 29 Aug 2018 08:51:51 +0000 (08:51 +0000)
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex

index f482de6fdc9bbd8781d6967bd103254d19f7fd0a..c90f9fa055e21a2801fdbb148579a6718a4adb2c 100644 (file)
@@ -850,9 +850,14 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
         |> Map.put("type", "Create")
         |> Map.put("blocking_user", user)
 
-      # adding title is a hack to not make empty lists function like a public timeline
+      # we must filter the following list for the user to avoid leaking statuses the user
+      # does not actually have permission to see (for more info, peruse security issue #270).
+      following_to =
+        following
+        |> Enum.filter(fn x -> x in user.following end)
+
       activities =
-        ActivityPub.fetch_activities([title | following], params)
+        ActivityPub.fetch_activities_bounded(following_to, following, params)
         |> Enum.reverse()
 
       conn