Skip to content

Commit

Permalink
chore: add limiter to correct function
Browse files Browse the repository at this point in the history
  • Loading branch information
rafasdc committed Sep 16, 2024
1 parent 013d451 commit 02a1373
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/backend/lib/s3upload.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Router } from 'express';
import RateLimit from 'express-rate-limit';
import formidable, { File } from 'formidable';
import fs from 'fs';
import config from '../../config';
Expand All @@ -8,9 +9,14 @@ import { commonFormidableConfig, parseForm } from './express-helper';

const AWS_S3_BUCKET = config.get('AWS_S3_BUCKET');

const limiter = RateLimit({
windowMs: 1 * 60 * 1000,
max: 2000,
});

const s3upload = Router();

s3upload.post('/api/s3/upload', async (req, res) => {
s3upload.post('/api/s3/upload', limiter, async (req, res) => {
const authRole = getAuthRole(req);
const isRoleAuthorized =
authRole?.pgRole === 'ccbc_admin' ||
Expand Down

0 comments on commit 02a1373

Please sign in to comment.