diff options
author | tusooa <tusooa@kazv.moe> | 2024-10-15 20:03:20 -0400 |
---|---|---|
committer | Lain Soykaf <lain@lain.com> | 2024-12-09 12:43:08 +0400 |
commit | b51f5a84eb7e2f3acb2d7fed54213a9680983bce (patch) | |
tree | ba352253d491ea7b6700d99853a807e204556162 /test | |
parent | 8c6b3d3ce6c01e4d3285fe5d370855507e11e814 (diff) | |
download | pleroma-b51f5a84eb7e2f3acb2d7fed54213a9680983bce.tar.gz pleroma-b51f5a84eb7e2f3acb2d7fed54213a9680983bce.zip |
Verify a local Update sent through AP C2S so users can only update their own objects
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/activity_pub/activity_pub_controller_test.exs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs index d4175b56f..b627478dc 100644 --- a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs @@ -1644,6 +1644,28 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do assert json_response(conn, 403) end + test "it rejects update activity of object from other actor", %{conn: conn} do + note_activity = insert(:note_activity) + note_object = Object.normalize(note_activity, fetch: false) + user = insert(:user) + + data = %{ + type: "Update", + object: %{ + id: note_object.data["id"] + } + } + + conn = + conn + |> assign(:user, user) + |> put_req_header("content-type", "application/activity+json") + |> post("/users/#{user.nickname}/outbox", data) + + assert json_response(conn, 400) + assert note_object == Object.normalize(note_activity, fetch: false) + end + test "it increases like count when receiving a like action", %{conn: conn} do note_activity = insert(:note_activity) note_object = Object.normalize(note_activity, fetch: false) |