From 319f9670bfd07f19862de565c7cc936ba7f6fda9 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 15 Jul 2022 11:06:27 +0200 Subject: Fix invalid http signature Date header could be inconsistent with the date included in the signature --- server/helpers/requests.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/helpers/requests.ts b/server/helpers/requests.ts index 495e83558..0756beb16 100644 --- a/server/helpers/requests.ts +++ b/server/helpers/requests.ts @@ -85,11 +85,14 @@ const peertubeGot = got.extend({ } httpSignature.signRequest({ - getHeader: function (header) { - return options.headers[header] + getHeader: function (header: string) { + const value = options.headers[header.toLowerCase()] + + if (!value) logger.warn('Unknown header requested by http-signature.', { headers: options.headers, header }) + return value }, - setHeader: function (header, value) { + setHeader: function (header: string, value: string) { options.headers[header] = value }, -- cgit v1.2.3