diff options
author | Chocobozzz <me@florianbigard.com> | 2022-07-15 11:06:27 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-07-15 11:06:27 +0200 |
commit | 319f9670bfd07f19862de565c7cc936ba7f6fda9 (patch) | |
tree | afb0fb3b9849fb707c3bfcc47547569a892be23f | |
parent | 4fdc7350202044b7d326dfcbf646eb106e2041e5 (diff) | |
download | PeerTube-319f9670bfd07f19862de565c7cc936ba7f6fda9.tar.gz PeerTube-319f9670bfd07f19862de565c7cc936ba7f6fda9.tar.zst PeerTube-319f9670bfd07f19862de565c7cc936ba7f6fda9.zip |
Fix invalid http signature
Date header could be inconsistent with the date included in the
signature
-rw-r--r-- | server/helpers/requests.ts | 9 |
1 files 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({ | |||
85 | } | 85 | } |
86 | 86 | ||
87 | httpSignature.signRequest({ | 87 | httpSignature.signRequest({ |
88 | getHeader: function (header) { | 88 | getHeader: function (header: string) { |
89 | return options.headers[header] | 89 | const value = options.headers[header.toLowerCase()] |
90 | |||
91 | if (!value) logger.warn('Unknown header requested by http-signature.', { headers: options.headers, header }) | ||
92 | return value | ||
90 | }, | 93 | }, |
91 | 94 | ||
92 | setHeader: function (header, value) { | 95 | setHeader: function (header: string, value: string) { |
93 | options.headers[header] = value | 96 | options.headers[header] = value |
94 | }, | 97 | }, |
95 | 98 | ||