Stabilize synapse patch properly

Signed-off-by: magic_rb <richard@brezak.sk>
This commit is contained in:
magic_rb 2023-10-24 12:58:36 +02:00
parent c5457193d1
commit 39c7d06663
No known key found for this signature in database
GPG key ID: 08D5287CC5DDCA0E
2 changed files with 37 additions and 6 deletions

View file

@ -0,0 +1,36 @@
From 3f0f28bca95f95e227ed9b7aff27e48a445564fd Mon Sep 17 00:00:00 2001
From: magic_rb <richard@brezak.sk>
Date: Mon, 16 Oct 2023 17:29:45 +0200
Subject: [PATCH] Fix http/s proxy authentication
Signed-off-by: magic_rb <richard@brezak.sk>
---
changelog.d/16504.bugfix | 1 +
synapse/http/connectproxyclient.py | 3 +--
2 files changed, 2 insertions(+), 2 deletions(-)
create mode 100644 changelog.d/16504.bugfix
diff --git a/changelog.d/16504.bugfix b/changelog.d/16504.bugfix
new file mode 100644
index 000000000..60839c474
--- /dev/null
+++ b/changelog.d/16504.bugfix
@@ -0,0 +1 @@
+Fix a bug introduced in Synapse 1.41 where HTTP(S) forward proxy authorization would fail when using basic HTTP authentication with a long `username:password` string.
diff --git a/synapse/http/connectproxyclient.py b/synapse/http/connectproxyclient.py
index 636efc33e..5bedca922 100644
--- a/synapse/http/connectproxyclient.py
+++ b/synapse/http/connectproxyclient.py
@@ -59,8 +59,7 @@ class BasicProxyCredentials(ProxyCredentials):
a Proxy-Authorization header.
"""
# Encode as base64 and prepend the authorization type
- return b"Basic " + base64.encodebytes(self.username_password)
-
+ return b"Basic " + base64.b64encode(self.username_password)
@attr.s(auto_attribs=True)
class BearerProxyCredentials(ProxyCredentials):
--
2.42.0

View file

@ -10,12 +10,7 @@ pkgs:
matrix-synapse-unwrapped =
pkgs.matrix-synapse-unwrapped.overridePythonAttrs (old: {
patches = (old.patches or []) ++ [
((pkgs.fetchurl {
url = "https://patch-diff.githubusercontent.com/raw/matrix-org/synapse/pull/16504.patch";
hash = "sha256-hjUOmsl06gVPewRdg/DyO9E5bSkIRNBAFJIrWqUsT6Y=";
}) // {
requiredSystemFeatures = [ "local" ];
})
./0001-Fix-http-s-proxy-authentication.patch
];
});
})