diff options
author | Mark Felder <feld@feld.me> | 2024-08-30 09:46:10 -0400 |
---|---|---|
committer | Mark Felder <feld@feld.me> | 2024-08-30 10:05:09 -0400 |
commit | 11ee94ae17094a2bc33505a31671b8c705f768a4 (patch) | |
tree | 9948452644534abdd16a347ab3e54783faec1d50 /test | |
parent | e38f5f1a817d6da30e9a128ec74a2a7c78faf174 (diff) | |
download | pleroma-11ee94ae17094a2bc33505a31671b8c705f768a4.tar.gz pleroma-11ee94ae17094a2bc33505a31671b8c705f768a4.zip |
InboxGuardPlug: Add early rejection of unknown activity types
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/activity_pub/activity_pub_controller_test.exs | 21 |
1 files changed, 21 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 c32f6c1a3..3bd589f49 100644 --- a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs @@ -711,6 +711,27 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do end) end + test "Unknown activity types are discarded", %{conn: conn} do + unknown_types = ["Poke", "Read", "Dazzle"] + + Enum.each(unknown_types, fn bad_type -> + params = + %{ + "type" => bad_type, + "actor" => "https://unknown.mastodon.instance/users/somebody" + } + |> Jason.encode!() + + conn + |> assign(:valid_signature, true) + |> put_req_header("content-type", "application/activity+json") + |> post("/inbox", params) + |> json_response(400) + + assert all_enqueued() == [] + end) + end + test "accepts Add/Remove activities", %{conn: conn} do object_id = "c61d6733-e256-4fe1-ab13-1e369789423f" |