Sfoglia il codice sorgente

Merge pull request #1312 from sharelatex/ja-add-rate-limits

Add rate limits to adding emails and changing password

GitOrigin-RevId: e73c17985cc9c74d60f8856b3b47b28fecd0d489
Ersun Warncke 7 anni fa
parent
commit
7bf860cde5
1 ha cambiato i file con 10 aggiunte e 0 eliminazioni
  1. 10 0
      services/web/app/coffee/router.coffee

+ 10 - 0
services/web/app/coffee/router.coffee

@@ -127,9 +127,19 @@ module.exports = class Router
 		if Features.hasFeature 'affiliations'
 			webRouter.post '/user/emails',
 				AuthenticationController.requireLogin(),
+				RateLimiterMiddlewear.rateLimit({
+					endpointName: 'add-email',
+					maxRequests: 10
+					timeInterval: 60
+				}),
 				UserEmailsController.add
 			webRouter.post '/user/emails/delete',
 				AuthenticationController.requireLogin(),
+				RateLimiterMiddlewear.rateLimit({
+					endpointName: 'delete-email',
+					maxRequests: 10
+					timeInterval: 60
+				}),
 				UserEmailsController.remove
 			webRouter.post '/user/emails/default',
 				AuthenticationController.requireLogin(),