Inject fake application metadata and validate it is stripped by transmogrifier
authorMark Felder <feld@feld.me>
Fri, 12 Feb 2021 19:05:12 +0000 (13:05 -0600)
committerMark Felder <feld@feld.me>
Fri, 12 Feb 2021 19:05:12 +0000 (13:05 -0600)
lib/pleroma/constants.ex
test/pleroma/web/activity_pub/transmogrifier_test.exs

index a40741ba606ecf54e001c989b255203793ba7816..9ee836d5d8a4c58784aa21003e2c0c8be0b10b2b 100644 (file)
@@ -18,7 +18,8 @@ defmodule Pleroma.Constants do
       "emoji",
       "context_id",
       "deleted_activity_id",
-      "pleroma_internal"
+      "pleroma_internal",
+      "application"
     ]
   )
 
index 7c97fa8f880a3faf92aa130d1fee2a3865c1cb01..2c99875ff249a4bcb9bca72688b9e89ea6345057 100644 (file)
@@ -202,7 +202,11 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
     test "it strips internal fields" do
       user = insert(:user)
 
-      {:ok, activity} = CommonAPI.post(user, %{status: "#2hu :firefox:"})
+      {:ok, activity} =
+        CommonAPI.post(user, %{
+          status: "#2hu :firefox:",
+          application: %{name: "TestClient", website: "https://pleroma.social"}
+        })
 
       {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
 
@@ -213,6 +217,7 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
       assert is_nil(modified["object"]["announcements"])
       assert is_nil(modified["object"]["announcement_count"])
       assert is_nil(modified["object"]["context_id"])
+      assert is_nil(modified["object"]["application"])
     end
 
     test "it strips internal fields of article" do