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/models/video/sql | |
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/models/video/sql')
-rw-r--r-- | server/models/video/sql/video/videos-id-list-query-builder.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/server/models/video/sql/video/videos-id-list-query-builder.ts b/server/models/video/sql/video/videos-id-list-query-builder.ts index 14f903851..7c864bf27 100644 --- a/server/models/video/sql/video/videos-id-list-query-builder.ts +++ b/server/models/video/sql/video/videos-id-list-query-builder.ts | |||
@@ -6,6 +6,7 @@ import { buildDirectionAndField, createSafeIn, parseRowCountResult } from '@serv | |||
6 | import { MUserAccountId, MUserId } from '@server/types/models' | 6 | import { MUserAccountId, MUserId } from '@server/types/models' |
7 | import { VideoInclude, VideoPrivacy, VideoState } from '@shared/models' | 7 | import { VideoInclude, VideoPrivacy, VideoState } from '@shared/models' |
8 | import { AbstractRunQuery } from '../../../shared/abstract-run-query' | 8 | import { AbstractRunQuery } from '../../../shared/abstract-run-query' |
9 | import { forceNumber } from '@shared/core-utils' | ||
9 | 10 | ||
10 | /** | 11 | /** |
11 | * | 12 | * |
@@ -689,12 +690,12 @@ export class VideosIdListQueryBuilder extends AbstractRunQuery { | |||
689 | } | 690 | } |
690 | 691 | ||
691 | private setLimit (countArg: number) { | 692 | private setLimit (countArg: number) { |
692 | const count = parseInt(countArg + '', 10) | 693 | const count = forceNumber(countArg) |
693 | this.limit = `LIMIT ${count}` | 694 | this.limit = `LIMIT ${count}` |
694 | } | 695 | } |
695 | 696 | ||
696 | private setOffset (startArg: number) { | 697 | private setOffset (startArg: number) { |
697 | const start = parseInt(startArg + '', 10) | 698 | const start = forceNumber(startArg) |
698 | this.offset = `OFFSET ${start}` | 699 | this.offset = `OFFSET ${start}` |
699 | } | 700 | } |
700 | } | 701 | } |