From 04ee5840c849673b2f798f1435427e6f2596b2db Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Mon, 14 Feb 2022 20:30:14 -0600 Subject: Remove redundant rate limiter Signed-off-by: Matt Strapp --- src/routes/api.ts | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'src') diff --git a/src/routes/api.ts b/src/routes/api.ts index 015bd45..4d55626 100644 --- a/src/routes/api.ts +++ b/src/routes/api.ts @@ -3,7 +3,6 @@ import express, { Request, Response } from 'express'; import csurf from 'csurf'; import cookieParser from 'cookie-parser'; import fileUpload, { UploadedFile } from 'express-fileupload'; -import rateLimit from 'express-rate-limit'; // For executing the python scripts import { access, stat } from 'fs/promises'; import { Stats } from 'fs'; @@ -22,15 +21,6 @@ api.use(fileUpload({ debug: false, // Log debug information })); -// Slow down frequent requests to prevent DoS attacks -const rateLimiter = rateLimit({ - windowMs: 1 * 60 * 1000, // 1 minute - max: 10, // Limit each IP to 10 requests per `window` (here, per 1 minutes) - standardHeaders: true, // Return rate limit info in the `RateLimit-*` headers - legacyHeaders: false, // Disable the `X-RateLimit-*` headers -}); -api.use(rateLimiter); - // CSRF protection api.use(cookieParser()); const csrf = csurf({ cookie: true }); @@ -111,6 +101,7 @@ api.route('/upload') */ api.route('/actuate') + // file deepcode ignore NoRateLimitingForExpensiveWebOperation: This is already rate limited by the website, so we don't need to do it again .post(csrf, async (req: Request, res: Response) => { // Make sure the file being requested to run exists try { -- cgit v1.2.3