mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-25 02:55:46 +03:00
Add test case to detect dodgy b64 encoding
This commit is contained in:
parent
f835ab8de5
commit
5fe76b9434
1 changed files with 14 additions and 0 deletions
|
@ -217,6 +217,20 @@ class ProxyParserTests(TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
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):
|
class MatrixFederationAgentTests(TestCase):
|
||||||
def setUp(self) -> None:
|
def setUp(self) -> None:
|
||||||
self.reactor = ThreadedMemoryReactorClock()
|
self.reactor = ThreadedMemoryReactorClock()
|
||||||
|
|
Loading…
Reference in a new issue