From 10a90ea48f46aab2c06c128be7d848b81748df13 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Wed, 18 Sep 2019 08:30:58 -0400 Subject: [PATCH] And another one --- lib/activitypub/middleware/http-signature.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/activitypub/middleware/http-signature.ts b/lib/activitypub/middleware/http-signature.ts index 4f583b8..8f579a5 100644 --- a/lib/activitypub/middleware/http-signature.ts +++ b/lib/activitypub/middleware/http-signature.ts @@ -25,6 +25,9 @@ export = async (req: Request, res: Response, next: NextFunction) => { console.log(`Could not retrieve actor ${req.body.actor} to validate HTTP signature for`, req.body); res.status(401).end("Could not retrieve actor to validate HTTP signature"); } + } else if (!actor.publicKey) { + console.log(`Could not validate HTTP signature, actor missing public key: ${actor}`); + res.status(401).end("Actor missing public key.") } else if (!validate(req, actor.publicKey.publicKeyPem)) { console.log(`Could not validate HTTP signature for ${req.body.actor}`); res.status(401).end("Could not validate HTTP signature");