Merge pull request #7194 from overleaf/jpa-rate-limit-zip-download

[web] rate-limit project zip download requests

GitOrigin-RevId: c99b7474de26b0e8a288863dccb60a25adfdc1b0
This commit is contained in:
Jakob Ackermann 2022-03-24 15:40:54 +00:00 committed by Copybot
parent c192002f53
commit f4d17f78f7

View file

@ -670,11 +670,22 @@ function initialize(webRouter, privateApiRouter, publicApiRouter) {
webRouter.get( webRouter.get(
'/Project/:Project_id/download/zip', '/Project/:Project_id/download/zip',
RateLimiterMiddleware.rateLimit({
endpointName: 'zip-download',
params: ['Project_id'],
maxRequests: 10,
timeInterval: 60,
}),
AuthorizationMiddleware.ensureUserCanReadProject, AuthorizationMiddleware.ensureUserCanReadProject,
ProjectDownloadsController.downloadProject ProjectDownloadsController.downloadProject
) )
webRouter.get( webRouter.get(
'/project/download/zip', '/project/download/zip',
RateLimiterMiddleware.rateLimit({
endpointName: 'multiple-projects-zip-download',
maxRequests: 10,
timeInterval: 60,
}),
AuthorizationMiddleware.ensureUserCanReadMultipleProjects, AuthorizationMiddleware.ensureUserCanReadMultipleProjects,
ProjectDownloadsController.downloadMultipleProjects ProjectDownloadsController.downloadMultipleProjects
) )