Better signature errors messages.
authorlain <lain@soykaf.club>
Sat, 24 Feb 2018 17:47:08 +0000 (18:47 +0100)
committerlain <lain@soykaf.club>
Sat, 24 Feb 2018 17:47:08 +0000 (18:47 +0100)
lib/pleroma/web/activity_pub/activity_pub_controller.ex

index a8dfccc4078a71637f5deefea4d30b135abe4884..4d0d900ac5c26062c0804c82af682da55bb04b3b 100644 (file)
@@ -34,9 +34,14 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
   end
 
   def inbox(conn, params) do
-    Logger.info("Signature error.")
-    Logger.info("Could not validate #{params["actor"]}")
-    Logger.info(inspect(conn.req_headers))
+    if !(String.contains(conn.req_headers["signature"] || "", params["actor"])) do
+      Logger.info("Signature not from author, relayed message, ignoring.")
+    else
+      Logger.info("Signature error.")
+      Logger.info("Could not validate #{params["actor"]}")
+      Logger.info(inspect(conn.req_headers))
+    end
+
     json(conn, "ok")
   end