diff --git a/nixng/containers/matrix/synapse/0001-Fix-http-s-proxy-authentication.patch b/nixng/containers/matrix/synapse/0001-Fix-http-s-proxy-authentication.patch new file mode 100644 index 0000000..ea62fa4 --- /dev/null +++ b/nixng/containers/matrix/synapse/0001-Fix-http-s-proxy-authentication.patch @@ -0,0 +1,36 @@ +From 3f0f28bca95f95e227ed9b7aff27e48a445564fd Mon Sep 17 00:00:00 2001 +From: magic_rb +Date: Mon, 16 Oct 2023 17:29:45 +0200 +Subject: [PATCH] Fix http/s proxy authentication + +Signed-off-by: magic_rb +--- + 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 + diff --git a/nixng/containers/matrix/synapse/synapse-package.nix b/nixng/containers/matrix/synapse/synapse-package.nix index afd74a8..e83fe2a 100644 --- a/nixng/containers/matrix/synapse/synapse-package.nix +++ b/nixng/containers/matrix/synapse/synapse-package.nix @@ -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 ]; }); })