From c207d77d51162249bc237b0f9f6125595385f21d Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Tue, 23 Jan 2024 02:04:10 +0100 Subject: [PATCH] Fix ToHeaderDictionary in HttpSignature --- .../Core/Federation/Cryptography/HttpSignature.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Iceshrimp.Backend/Core/Federation/Cryptography/HttpSignature.cs b/Iceshrimp.Backend/Core/Federation/Cryptography/HttpSignature.cs index 04038a67..7e05f7b0 100644 --- a/Iceshrimp.Backend/Core/Federation/Cryptography/HttpSignature.cs +++ b/Iceshrimp.Backend/Core/Federation/Cryptography/HttpSignature.cs @@ -11,7 +11,7 @@ public static class HttpSignature { IEnumerable requiredHeaders, string key) { if (!requiredHeaders.All(signature.Headers.Contains)) throw new ConstraintException("Request is missing required headers"); - + //TODO: verify date header exists and is set to something the last 12 hours var signingString = GenerateSigningString(signature.Headers, request.Method, @@ -86,7 +86,8 @@ public static class HttpSignature { } private static HeaderDictionary ToHeaderDictionary(this HttpRequestHeaders headers) { - return new HeaderDictionary(headers.ToDictionary(p => p.Key, p => new StringValues(p.Value.ToArray()))); + return new HeaderDictionary(headers.ToDictionary(p => p.Key.ToLowerInvariant(), + p => new StringValues(p.Value.ToArray()))); } public static HttpSignatureHeader Parse(string header) {