mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-23 17:54:22 +00:00
Handle MRF rejections of incoming AP activities
This commit is contained in:
parent
ba72d02f86
commit
8b2fa31fed
|
@ -267,6 +267,9 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
||||||
else
|
else
|
||||||
{:fake, true, activity} ->
|
{:fake, true, activity} ->
|
||||||
{:ok, activity}
|
{:ok, activity}
|
||||||
|
|
||||||
|
{:error, message} ->
|
||||||
|
{:error, message}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -229,5 +229,21 @@ defmodule Pleroma.Web.FederatorTest do
|
||||||
|
|
||||||
:error = Federator.incoming_ap_doc(params)
|
:error = Federator.incoming_ap_doc(params)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "it does not crash if MRF rejects the post" do
|
||||||
|
policies = Pleroma.Config.get([:instance, :rewrite_policy])
|
||||||
|
mrf_keyword_policy = Pleroma.Config.get(:mrf_keyword)
|
||||||
|
Pleroma.Config.put([:mrf_keyword, :reject], ["lain"])
|
||||||
|
Pleroma.Config.put([:instance, :rewrite_policy], Pleroma.Web.ActivityPub.MRF.KeywordPolicy)
|
||||||
|
|
||||||
|
params =
|
||||||
|
File.read!("test/fixtures/mastodon-post-activity.json")
|
||||||
|
|> Poison.decode!()
|
||||||
|
|
||||||
|
assert Federator.incoming_ap_doc(params) == :error
|
||||||
|
|
||||||
|
Pleroma.Config.put([:instance, :rewrite_policy], policies)
|
||||||
|
Pleroma.Config.put(:mrf_keyword, mrf_keyword_policy)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue