aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/index.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-06-20 14:17:34 +0200
committerChocobozzz <me@florianbigard.com>2023-06-20 14:17:34 +0200
commite915cde30ec47258a2beeec5ca748c928b59858c (patch)
treef5692ab20c534a61487f3bd471bb6105ed58d88a /server/controllers/api/index.ts
parent923e41fa4f342019298b46e407ea1f0207f74205 (diff)
downloadPeerTube-e915cde30ec47258a2beeec5ca748c928b59858c.tar.gz
PeerTube-e915cde30ec47258a2beeec5ca748c928b59858c.tar.zst
PeerTube-e915cde30ec47258a2beeec5ca748c928b59858c.zip
Fix runner api rate limit bypass
Diffstat (limited to 'server/controllers/api/index.ts')
-rw-r--r--server/controllers/api/index.ts11
1 files changed, 3 insertions, 8 deletions
diff --git a/server/controllers/api/index.ts b/server/controllers/api/index.ts
index 646f9597e..31f1a56f9 100644
--- a/server/controllers/api/index.ts
+++ b/server/controllers/api/index.ts
@@ -1,9 +1,8 @@
1import cors from 'cors' 1import cors from 'cors'
2import express from 'express' 2import express from 'express'
3import { buildRateLimiter } from '@server/middlewares' 3
4import { HttpStatusCode } from '../../../shared/models' 4import { HttpStatusCode } from '../../../shared/models'
5import { badRequest } from '../../helpers/express-utils' 5import { badRequest } from '../../helpers/express-utils'
6import { CONFIG } from '../../initializers/config'
7import { abuseRouter } from './abuse' 6import { abuseRouter } from './abuse'
8import { accountsRouter } from './accounts' 7import { accountsRouter } from './accounts'
9import { blocklistRouter } from './blocklist' 8import { blocklistRouter } from './blocklist'
@@ -32,12 +31,6 @@ apiRouter.use(cors({
32 credentials: true 31 credentials: true
33})) 32}))
34 33
35const apiRateLimiter = buildRateLimiter({
36 windowMs: CONFIG.RATES_LIMIT.API.WINDOW_MS,
37 max: CONFIG.RATES_LIMIT.API.MAX
38})
39apiRouter.use(apiRateLimiter)
40
41apiRouter.use('/server', serverRouter) 34apiRouter.use('/server', serverRouter)
42apiRouter.use('/abuses', abuseRouter) 35apiRouter.use('/abuses', abuseRouter)
43apiRouter.use('/bulk', bulkRouter) 36apiRouter.use('/bulk', bulkRouter)
@@ -57,6 +50,8 @@ apiRouter.use('/plugins', pluginRouter)
57apiRouter.use('/custom-pages', customPageRouter) 50apiRouter.use('/custom-pages', customPageRouter)
58apiRouter.use('/blocklist', blocklistRouter) 51apiRouter.use('/blocklist', blocklistRouter)
59apiRouter.use('/runners', runnersRouter) 52apiRouter.use('/runners', runnersRouter)
53
54// apiRouter.use(apiRateLimiter)
60apiRouter.use('/ping', pong) 55apiRouter.use('/ping', pong)
61apiRouter.use('/*', badRequest) 56apiRouter.use('/*', badRequest)
62 57