aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-01-29 15:17:42 +0100
committerChocobozzz <me@florianbigard.com>2020-01-29 15:17:42 +0100
commit75ba887d10eacb9cd1392e62f68617c7643c9add (patch)
treeab8e76cb3239e4a365ded4e65028e91479fc1e57 /server/middlewares
parent0bc1b31d60ed0edf3999f51743b653068ef1816e (diff)
downloadPeerTube-75ba887d10eacb9cd1392e62f68617c7643c9add.tar.gz
PeerTube-75ba887d10eacb9cd1392e62f68617c7643c9add.tar.zst
PeerTube-75ba887d10eacb9cd1392e62f68617c7643c9add.zip
Don't log error on actor delete signature error
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/activitypub.ts11
-rw-r--r--server/middlewares/validators/videos/video-rates.ts4
2 files changed, 11 insertions, 4 deletions
diff --git a/server/middlewares/activitypub.ts b/server/middlewares/activitypub.ts
index c906e785c..f3feae41e 100644
--- a/server/middlewares/activitypub.ts
+++ b/server/middlewares/activitypub.ts
@@ -1,10 +1,11 @@
1import { NextFunction, Request, Response } from 'express' 1import { NextFunction, Request, Response } from 'express'
2import { ActivityPubSignature } from '../../shared' 2import { ActivityDelete, ActivityPubSignature } from '../../shared'
3import { logger } from '../helpers/logger' 3import { logger } from '../helpers/logger'
4import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../helpers/peertube-crypto' 4import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../helpers/peertube-crypto'
5import { ACCEPT_HEADERS, ACTIVITY_PUB, HTTP_SIGNATURE } from '../initializers/constants' 5import { ACCEPT_HEADERS, ACTIVITY_PUB, HTTP_SIGNATURE } from '../initializers/constants'
6import { getOrCreateActorAndServerAndModel } from '../lib/activitypub' 6import { getOrCreateActorAndServerAndModel } from '../lib/activitypub'
7import { loadActorUrlOrGetFromWebfinger } from '../helpers/webfinger' 7import { loadActorUrlOrGetFromWebfinger } from '../helpers/webfinger'
8import { isActorDeleteActivityValid } from '@server/helpers/custom-validators/activitypub/actor'
8 9
9async function checkSignature (req: Request, res: Response, next: NextFunction) { 10async function checkSignature (req: Request, res: Response, next: NextFunction) {
10 try { 11 try {
@@ -23,7 +24,13 @@ async function checkSignature (req: Request, res: Response, next: NextFunction)
23 24
24 return next() 25 return next()
25 } catch (err) { 26 } catch (err) {
26 logger.warn('Error in ActivityPub signature checker.', err) 27 const activity: ActivityDelete = req.body
28 if (isActorDeleteActivityValid(activity) && activity.object === activity.actor) {
29 logger.debug('Handling signature error on actor delete activity', { err })
30 return res.sendStatus(204)
31 }
32
33 logger.warn('Error in ActivityPub signature checker.', { err })
27 return res.sendStatus(403) 34 return res.sendStatus(403)
28 } 35 }
29} 36}
diff --git a/server/middlewares/validators/videos/video-rates.ts b/server/middlewares/validators/videos/video-rates.ts
index 4021cfecc..5d5fae8aa 100644
--- a/server/middlewares/validators/videos/video-rates.ts
+++ b/server/middlewares/validators/videos/video-rates.ts
@@ -24,7 +24,7 @@ const videoUpdateRateValidator = [
24 } 24 }
25] 25]
26 26
27const getAccountVideoRateValidator = function (rateType: VideoRateType) { 27const getAccountVideoRateValidatorFactory = function (rateType: VideoRateType) {
28 return [ 28 return [
29 param('name').custom(isAccountNameValid).withMessage('Should have a valid account name'), 29 param('name').custom(isAccountNameValid).withMessage('Should have a valid account name'),
30 param('videoId').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid videoId'), 30 param('videoId').custom(isIdOrUUIDValid).not().isEmpty().withMessage('Should have a valid videoId'),
@@ -64,6 +64,6 @@ const videoRatingValidator = [
64 64
65export { 65export {
66 videoUpdateRateValidator, 66 videoUpdateRateValidator,
67 getAccountVideoRateValidator, 67 getAccountVideoRateValidatorFactory,
68 videoRatingValidator 68 videoRatingValidator
69} 69}