This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Fix http/s proxy authentication with long username/passwords#16504
Merged
clokep merged 6 commits intomatrix-org:developfrom Oct 24, 2023
Merged
Fix http/s proxy authentication with long username/passwords#16504clokep merged 6 commits intomatrix-org:developfrom
clokep merged 6 commits intomatrix-org:developfrom
Conversation
Contributor
Author
|
I'm not sure if the changelog change should be squashed with the actual change or not, please advise. |
Member
It doesn't matter, we squash merge anyway. So don't bother. |
clokep
reviewed
Oct 16, 2023
Contributor
Author
|
i will apply what the lint said and force push |
446f012 to
4f69a64
Compare
Contributor
Author
|
Took me a while, sorry about that :) it's faster than trying to get the infra working on NixOS |
Contributor
|
Introduced in #10475 |
DMRobertson
reviewed
Oct 23, 2023
Contributor
|
The following patch adds a test case which reproduces the issue. Could you apply it and include it as part of this PR? From 5fe76b9434e22bb752c252dd9c66c3c2bfb90dfc Mon Sep 17 00:00:00 2001
From: David Robertson <davidr@element.io>
Date: Mon, 23 Oct 2023 19:21:23 +0100
Subject: [PATCH] Add test case to detect dodgy b64 encoding
---
tests/http/test_proxyagent.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/tests/http/test_proxyagent.py b/tests/http/test_proxyagent.py
index 8164b0b78e..b48c2c293a 100644
--- a/tests/http/test_proxyagent.py
+++ b/tests/http/test_proxyagent.py
@@ -217,6 +217,20 @@ def test_parse_proxy(
)
+class TestBasicProxyCredentials(TestCase):
+ def test_long_user_pass_string_encoded_without_newlines(self) -> None:
+ """Reproduces https://github.com/matrix-org/synapse/pull/16504."""
+ creds = BasicProxyCredentials(
+ b"looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooonguser:pass@proxy.local:9988"
+ )
+ auth_value = creds.as_proxy_authorization_value()
+ self.assertNotIn(b"\n", auth_value)
+ self.assertEqual(
+ creds.as_proxy_authorization_value(),
+ b"Basic: bG9vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vbmd1c2VyOnBhc3M=",
+ )
+
+
class MatrixFederationAgentTests(TestCase):
def setUp(self) -> None:
self.reactor = ThreadedMemoryReactorClock()
--
2.41.0 |
Signed-off-by: magic_rb <richard@brezak.sk>
4f69a64 to
47861e9
Compare
clokep
reviewed
Oct 24, 2023
Contributor
|
Hmm. That test is failing and I don't know why. |
Contributor
|
Oh, it's because I passed the entire auth string into the credentials constructor, rather than just the username:password. I'll fix. |
clokep
reviewed
Oct 24, 2023
added 3 commits
October 24, 2023 13:49
Member
|
Thank you! 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist
EventStoretoEventWorkerStore.".code blocks.(run the linters)