diff options
author | Chocobozzz <me@florianbigard.com> | 2020-01-29 15:17:42 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-01-29 15:17:42 +0100 |
commit | 75ba887d10eacb9cd1392e62f68617c7643c9add (patch) | |
tree | ab8e76cb3239e4a365ded4e65028e91479fc1e57 /server/middlewares/activitypub.ts | |
parent | 0bc1b31d60ed0edf3999f51743b653068ef1816e (diff) | |
download | PeerTube-75ba887d10eacb9cd1392e62f68617c7643c9add.tar.gz PeerTube-75ba887d10eacb9cd1392e62f68617c7643c9add.tar.zst PeerTube-75ba887d10eacb9cd1392e62f68617c7643c9add.zip |
Don't log error on actor delete signature error
Diffstat (limited to 'server/middlewares/activitypub.ts')
-rw-r--r-- | server/middlewares/activitypub.ts | 11 |
1 files changed, 9 insertions, 2 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 @@ | |||
1 | import { NextFunction, Request, Response } from 'express' | 1 | import { NextFunction, Request, Response } from 'express' |
2 | import { ActivityPubSignature } from '../../shared' | 2 | import { ActivityDelete, ActivityPubSignature } from '../../shared' |
3 | import { logger } from '../helpers/logger' | 3 | import { logger } from '../helpers/logger' |
4 | import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../helpers/peertube-crypto' | 4 | import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../helpers/peertube-crypto' |
5 | import { ACCEPT_HEADERS, ACTIVITY_PUB, HTTP_SIGNATURE } from '../initializers/constants' | 5 | import { ACCEPT_HEADERS, ACTIVITY_PUB, HTTP_SIGNATURE } from '../initializers/constants' |
6 | import { getOrCreateActorAndServerAndModel } from '../lib/activitypub' | 6 | import { getOrCreateActorAndServerAndModel } from '../lib/activitypub' |
7 | import { loadActorUrlOrGetFromWebfinger } from '../helpers/webfinger' | 7 | import { loadActorUrlOrGetFromWebfinger } from '../helpers/webfinger' |
8 | import { isActorDeleteActivityValid } from '@server/helpers/custom-validators/activitypub/actor' | ||
8 | 9 | ||
9 | async function checkSignature (req: Request, res: Response, next: NextFunction) { | 10 | async 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 | } |