aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/runners/jobs.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/runners/jobs.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/runners/jobs.ts')
-rw-r--r--server/controllers/api/runners/jobs.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/server/controllers/api/runners/jobs.ts b/server/controllers/api/runners/jobs.ts
index 140f062be..5d687e689 100644
--- a/server/controllers/api/runners/jobs.ts
+++ b/server/controllers/api/runners/jobs.ts
@@ -7,6 +7,7 @@ import { MIMETYPES } from '@server/initializers/constants'
7import { sequelizeTypescript } from '@server/initializers/database' 7import { sequelizeTypescript } from '@server/initializers/database'
8import { getRunnerJobHandlerClass, updateLastRunnerContact } from '@server/lib/runners' 8import { getRunnerJobHandlerClass, updateLastRunnerContact } from '@server/lib/runners'
9import { 9import {
10 apiRateLimiter,
10 asyncMiddleware, 11 asyncMiddleware,
11 authenticate, 12 authenticate,
12 ensureUserHasRight, 13 ensureUserHasRight,
@@ -69,11 +70,13 @@ const runnerJobsRouter = express.Router()
69// --------------------------------------------------------------------------- 70// ---------------------------------------------------------------------------
70 71
71runnerJobsRouter.post('/jobs/request', 72runnerJobsRouter.post('/jobs/request',
73 apiRateLimiter,
72 asyncMiddleware(getRunnerFromTokenValidator), 74 asyncMiddleware(getRunnerFromTokenValidator),
73 asyncMiddleware(requestRunnerJob) 75 asyncMiddleware(requestRunnerJob)
74) 76)
75 77
76runnerJobsRouter.post('/jobs/:jobUUID/accept', 78runnerJobsRouter.post('/jobs/:jobUUID/accept',
79 apiRateLimiter,
77 asyncMiddleware(runnerJobGetValidator), 80 asyncMiddleware(runnerJobGetValidator),
78 acceptRunnerJobValidator, 81 acceptRunnerJobValidator,
79 asyncMiddleware(getRunnerFromTokenValidator), 82 asyncMiddleware(getRunnerFromTokenValidator),
@@ -81,6 +84,7 @@ runnerJobsRouter.post('/jobs/:jobUUID/accept',
81) 84)
82 85
83runnerJobsRouter.post('/jobs/:jobUUID/abort', 86runnerJobsRouter.post('/jobs/:jobUUID/abort',
87 apiRateLimiter,
84 asyncMiddleware(jobOfRunnerGetValidator), 88 asyncMiddleware(jobOfRunnerGetValidator),
85 abortRunnerJobValidator, 89 abortRunnerJobValidator,
86 asyncMiddleware(abortRunnerJob) 90 asyncMiddleware(abortRunnerJob)
@@ -88,6 +92,7 @@ runnerJobsRouter.post('/jobs/:jobUUID/abort',
88 92
89runnerJobsRouter.post('/jobs/:jobUUID/update', 93runnerJobsRouter.post('/jobs/:jobUUID/update',
90 runnerJobUpdateVideoFiles, 94 runnerJobUpdateVideoFiles,
95 apiRateLimiter, // Has to be after multer middleware to parse runner token
91 asyncMiddleware(jobOfRunnerGetValidator), 96 asyncMiddleware(jobOfRunnerGetValidator),
92 updateRunnerJobValidator, 97 updateRunnerJobValidator,
93 asyncMiddleware(updateRunnerJobController) 98 asyncMiddleware(updateRunnerJobController)
@@ -101,6 +106,7 @@ runnerJobsRouter.post('/jobs/:jobUUID/error',
101 106
102runnerJobsRouter.post('/jobs/:jobUUID/success', 107runnerJobsRouter.post('/jobs/:jobUUID/success',
103 postRunnerJobSuccessVideoFiles, 108 postRunnerJobSuccessVideoFiles,
109 apiRateLimiter, // Has to be after multer middleware to parse runner token
104 asyncMiddleware(jobOfRunnerGetValidator), 110 asyncMiddleware(jobOfRunnerGetValidator),
105 successRunnerJobValidator, 111 successRunnerJobValidator,
106 asyncMiddleware(postRunnerJobSuccess) 112 asyncMiddleware(postRunnerJobSuccess)