From 8d899d61970a566eb828330d1292df31f1f7b938 Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Tue, 20 Aug 2019 22:10:36 +0700 Subject: [PATCH] Add `:ap_routes` rate limit --- config/config.exs | 3 ++- config/test.exs | 3 ++- lib/pleroma/web/ostatus/ostatus_controller.ex | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/config.exs b/config/config.exs index 758661120..2f6145516 100644 --- a/config/config.exs +++ b/config/config.exs @@ -548,7 +548,8 @@ config :pleroma, :rate_limit, statuses_actions: {10_000, 15}, status_id_action: {60_000, 3}, password_reset: {1_800_000, 5}, - account_confirmation_resend: {8_640_000, 5} + account_confirmation_resend: {8_640_000, 5}, + ap_routes: {60_000, 15} # Import environment specific config. This must remain at the bottom # of this file so it overrides the configuration defined above. diff --git a/config/test.exs b/config/test.exs index 6f75f39b5..30a51f734 100644 --- a/config/test.exs +++ b/config/test.exs @@ -71,7 +71,8 @@ config :pleroma, Pleroma.ScheduledActivity, config :pleroma, :rate_limit, search: [{1000, 30}, {1000, 30}], app_account_creation: {10_000, 5}, - password_reset: {1000, 30} + password_reset: {1000, 30}, + ap_routes: nil config :pleroma, :http_security, report_uri: "https://endpoint.com" diff --git a/lib/pleroma/web/ostatus/ostatus_controller.ex b/lib/pleroma/web/ostatus/ostatus_controller.ex index c70063b84..305901dfd 100644 --- a/lib/pleroma/web/ostatus/ostatus_controller.ex +++ b/lib/pleroma/web/ostatus/ostatus_controller.ex @@ -22,6 +22,8 @@ defmodule Pleroma.Web.OStatus.OStatusController do alias Pleroma.Web.Router alias Pleroma.Web.XML + plug(Pleroma.Plugs.RateLimiter, :ap_routes when action in [:object, :activity]) + plug(Pleroma.Web.FederatingPlug when action in [:salmon_incoming]) plug( -- 2.45.2