implement hellthread mitigation Closes #474 See merge request pleroma/pleroma!588stable
commit
093d39b634
@ -0,0 +1,18 @@
|
|||||||
|
defmodule Pleroma.Web.ActivityPub.MRF.HellthreadPolicy do
|
||||||
|
@behaviour Pleroma.Web.ActivityPub.MRF
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def filter(%{"type" => "Create"} = object) do
|
||||||
|
threshold = Pleroma.Config.get([:mrf_hellthread, :threshold])
|
||||||
|
recipients = (object["to"] || []) ++ (object["cc"] || [])
|
||||||
|
|
||||||
|
if length(recipients) > threshold do
|
||||||
|
{:reject, nil}
|
||||||
|
else
|
||||||
|
{:ok, object}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@impl true
|
||||||
|
def filter(object), do: {:ok, object}
|
||||||
|
end
|
Loading…
Reference in new issue