diff options
author | lain <lain@soykaf.club> | 2023-12-22 11:04:25 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2023-12-22 11:04:25 +0000 |
commit | 5f1d70736711275ac9f0c95e5ada4cb2f1a96e11 (patch) | |
tree | 6833570d3e8adc622d8822b27bd2927b70fa059a /lib | |
parent | bd50892c25ac2491c848a644304b323c9eec183f (diff) | |
parent | f43f33e3078385084136295d2a3320efa6cb4134 (diff) | |
download | pleroma-5f1d70736711275ac9f0c95e5ada4cb2f1a96e11.tar.gz pleroma-5f1d70736711275ac9f0c95e5ada4cb2f1a96e11.zip |
Merge branch 'bad_inbox_request' into 'develop'
Return a 400 from a bad delivery attempt to the inbox
Closes #2884
See merge request pleroma/pleroma!4009
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/activity_pub/activity_pub_controller.ex | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/pleroma/web/activity_pub/activity_pub_controller.ex b/lib/pleroma/web/activity_pub/activity_pub_controller.ex index 3f76531c6..e38a94966 100644 --- a/lib/pleroma/web/activity_pub/activity_pub_controller.ex +++ b/lib/pleroma/web/activity_pub/activity_pub_controller.ex @@ -273,12 +273,17 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do end def inbox(%{assigns: %{valid_signature: true}} = conn, %{"nickname" => nickname} = params) do - with %User{} = recipient <- User.get_cached_by_nickname(nickname), - {:ok, %User{} = actor} <- User.get_or_fetch_by_ap_id(params["actor"]), + with %User{is_active: true} = recipient <- User.get_cached_by_nickname(nickname), + {:ok, %User{is_active: true} = actor} <- User.get_or_fetch_by_ap_id(params["actor"]), true <- Utils.recipient_in_message(recipient, actor, params), params <- Utils.maybe_splice_recipient(recipient.ap_id, params) do Federator.incoming_ap_doc(params) json(conn, "ok") + else + _ -> + conn + |> put_status(:bad_request) + |> json("Invalid request.") end end |