diff options
author | Chocobozzz <me@florianbigard.com> | 2018-05-11 15:41:54 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-05-11 15:41:54 +0200 |
commit | 5cf135001124cd19183336dbfcae1cd432217b00 (patch) | |
tree | 2741f19ef66750a320c179dd8af435f6f768a98d /server/lib | |
parent | 0f320037e689b2778959c12ddd4ce790f6e4ae4f (diff) | |
download | PeerTube-5cf135001124cd19183336dbfcae1cd432217b00.tar.gz PeerTube-5cf135001124cd19183336dbfcae1cd432217b00.tar.zst PeerTube-5cf135001124cd19183336dbfcae1cd432217b00.zip |
Improve AP validation for Notes
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/activitypub/video-comments.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/server/lib/activitypub/video-comments.ts b/server/lib/activitypub/video-comments.ts index 8ab0cdba4..60c9179a6 100644 --- a/server/lib/activitypub/video-comments.ts +++ b/server/lib/activitypub/video-comments.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { VideoCommentObject } from '../../../shared/models/activitypub/objects/video-comment-object' | 1 | import { VideoCommentObject } from '../../../shared/models/activitypub/objects/video-comment-object' |
2 | import { isVideoCommentObjectValid } from '../../helpers/custom-validators/activitypub/video-comments' | 2 | import { sanitizeAndCheckVideoCommentObject } from '../../helpers/custom-validators/activitypub/video-comments' |
3 | import { logger } from '../../helpers/logger' | 3 | import { logger } from '../../helpers/logger' |
4 | import { doRequest } from '../../helpers/requests' | 4 | import { doRequest } from '../../helpers/requests' |
5 | import { ACTIVITY_PUB } from '../../initializers' | 5 | import { ACTIVITY_PUB } from '../../initializers' |
@@ -52,7 +52,7 @@ async function addVideoComment (videoInstance: VideoModel, commentUrl: string) { | |||
52 | activityPub: true | 52 | activityPub: true |
53 | }) | 53 | }) |
54 | 54 | ||
55 | if (isVideoCommentObjectValid(body) === false) { | 55 | if (sanitizeAndCheckVideoCommentObject(body) === false) { |
56 | logger.debug('Remote video comment JSON is not valid.', { body }) | 56 | logger.debug('Remote video comment JSON is not valid.', { body }) |
57 | return undefined | 57 | return undefined |
58 | } | 58 | } |
@@ -123,7 +123,7 @@ async function resolveThread (url: string, comments: VideoCommentModel[] = []) { | |||
123 | activityPub: true | 123 | activityPub: true |
124 | }) | 124 | }) |
125 | 125 | ||
126 | if (isVideoCommentObjectValid(body) === false) { | 126 | if (sanitizeAndCheckVideoCommentObject(body) === false) { |
127 | throw new Error('Remote video comment JSON is not valid :' + JSON.stringify(body)) | 127 | throw new Error('Remote video comment JSON is not valid :' + JSON.stringify(body)) |
128 | } | 128 | } |
129 | 129 | ||