From e92269053e3fd0e9b9c155ded86a1668444f3d70 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 7 Jan 2020 15:24:27 +0100 Subject: Update http signature --- server/middlewares/activitypub.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'server/middlewares/activitypub.ts') diff --git a/server/middlewares/activitypub.ts b/server/middlewares/activitypub.ts index fedac0e05..bd3bdb076 100644 --- a/server/middlewares/activitypub.ts +++ b/server/middlewares/activitypub.ts @@ -51,10 +51,11 @@ export { // --------------------------------------------------------------------------- async function checkHttpSignature (req: Request, res: Response) { - // FIXME: mastodon does not include the Signature scheme + // FIXME: compatibility with http-signature < v1.3 const sig = req.headers[HTTP_SIGNATURE.HEADER_NAME] as string - if (sig && sig.startsWith('Signature ') === false) req.headers[HTTP_SIGNATURE.HEADER_NAME] = 'Signature ' + sig + if (sig && sig.startsWith('Signature ') === true) req.headers[HTTP_SIGNATURE.HEADER_NAME] = sig.replace(/^Signature /, '') + logger.info('coucou', { signature: req.headers[HTTP_SIGNATURE.HEADER_NAME] }) const parsed = parseHTTPSignature(req, HTTP_SIGNATURE.CLOCK_SKEW_SECONDS) const keyId = parsed.keyId -- cgit v1.2.3