Przeglądaj źródła

Add test case to detect dodgy b64 encoding

tags/v1.96.0rc1
David Robertson 7 miesięcy temu
rodzic
commit
5fe76b9434
Nie znaleziono w bazie danych klucza dla tego podpisu ID klucza GPG: 903ECE108A39DEDD
1 zmienionych plików z 14 dodań i 0 usunięć
  1. +14
    -0
      tests/http/test_proxyagent.py

+ 14
- 0
tests/http/test_proxyagent.py Wyświetl plik

@@ -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):
def setUp(self) -> None:
self.reactor = ThreadedMemoryReactorClock()


Ładowanie…
Anuluj
Zapisz