diff options
author | Chocobozzz <me@florianbigard.com> | 2022-11-15 14:41:55 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-11-15 14:41:55 +0100 |
commit | 4638cd713dcdd007cd7f49b9a95fa62ac7823e7c (patch) | |
tree | 3e341c6ebbd1ce9e2bbacd72e7e3793e0bd467c2 /server/helpers/custom-validators/video-studio.ts | |
parent | 6bcb559fc9a491fc3ce83e7c077ee9dc742b1d63 (diff) | |
download | PeerTube-4638cd713dcdd007cd7f49b9a95fa62ac7823e7c.tar.gz PeerTube-4638cd713dcdd007cd7f49b9a95fa62ac7823e7c.tar.zst PeerTube-4638cd713dcdd007cd7f49b9a95fa62ac7823e7c.zip |
Don't inject untrusted input
Even if it's already checked in middlewares
It's better to have safe modals too
Diffstat (limited to 'server/helpers/custom-validators/video-studio.ts')
-rw-r--r-- | server/helpers/custom-validators/video-studio.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/server/helpers/custom-validators/video-studio.ts b/server/helpers/custom-validators/video-studio.ts index 19e7906d5..68dfec8dd 100644 --- a/server/helpers/custom-validators/video-studio.ts +++ b/server/helpers/custom-validators/video-studio.ts | |||
@@ -4,6 +4,7 @@ import { buildTaskFileFieldname } from '@server/lib/video-studio' | |||
4 | import { VideoStudioTask } from '@shared/models' | 4 | import { VideoStudioTask } from '@shared/models' |
5 | import { isArray } from './misc' | 5 | import { isArray } from './misc' |
6 | import { isVideoFileMimeTypeValid, isVideoImageValid } from './videos' | 6 | import { isVideoFileMimeTypeValid, isVideoImageValid } from './videos' |
7 | import { forceNumber } from '@shared/core-utils' | ||
7 | 8 | ||
8 | function isValidStudioTasksArray (tasks: any) { | 9 | function isValidStudioTasksArray (tasks: any) { |
9 | if (!isArray(tasks)) return false | 10 | if (!isArray(tasks)) return false |
@@ -24,7 +25,7 @@ function isStudioCutTaskValid (task: VideoStudioTask) { | |||
24 | 25 | ||
25 | if (!start || !end) return true | 26 | if (!start || !end) return true |
26 | 27 | ||
27 | return parseInt(start + '') < parseInt(end + '') | 28 | return forceNumber(start) < forceNumber(end) |
28 | } | 29 | } |
29 | 30 | ||
30 | function isStudioTaskAddIntroOutroValid (task: VideoStudioTask, indice: number, files: Express.Multer.File[]) { | 31 | function isStudioTaskAddIntroOutroValid (task: VideoStudioTask, indice: number, files: Express.Multer.File[]) { |