Просмотр исходного кода

Merge pull request #1657 from sharelatex/sk-rate-limit-join-project

Add a rate-limit to joinProject

GitOrigin-RevId: 27edd8b56ae80868b5fcd0b803d0e042dce26f31
Shane Kilkelly 7 лет назад
Родитель
Сommit
f3dd61abce
1 измененных файлов с 7 добавлено и 1 удалено
  1. 7 1
      services/web/app/coffee/Features/Editor/EditorRouter.coffee

+ 7 - 1
services/web/app/coffee/Features/Editor/EditorRouter.coffee

@@ -30,4 +30,10 @@ module.exports =
 		# Called by the real-time API to load up the current project state.
 		# This is a post request because it's more than just a getting of data. We take actions
 		# whenever a user joins a project, like updating the deleted status.
-		apiRouter.post '/project/:Project_id/join', AuthenticationController.httpAuth, EditorHttpController.joinProject
+		apiRouter.post '/project/:Project_id/join', AuthenticationController.httpAuth,
+			RateLimiterMiddleware.rateLimit({
+				endpointName: "join-project"
+				params: ["Project_id"]
+				maxRequests: 30
+				timeInterval: 60
+			}), EditorHttpController.joinProject