Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 5565f45

Browse files
author
David Robertson
authored
Actually fix bad debug logging rejecting device list & signing key transactions (#12098)
1 parent 9e83521 commit 5565f45

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

changelog.d/12098.bugfix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a bug introduced in Synapse 1.51.0rc1 where incoming federation transactions containing at least one EDU would be dropped if debug logging was enabled for `synapse.8631_debug`.

synapse/federation/transport/server/federation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ async def on_PUT(
110110
if issue_8631_logger.isEnabledFor(logging.DEBUG):
111111
DEVICE_UPDATE_EDUS = ["m.device_list_update", "m.signing_key_update"]
112112
device_list_updates = [
113-
edu.content
113+
edu.get("content", {})
114114
for edu in transaction_data.get("edus", [])
115115
if edu.get("edu_type") in DEVICE_UPDATE_EDUS
116116
]

tests/federation/transport/test_server.py

+19-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
from tests import unittest
16-
from tests.unittest import override_config
16+
from tests.unittest import DEBUG, override_config
1717

1818

1919
class RoomDirectoryFederationTests(unittest.FederatingHomeserverTestCase):
@@ -38,3 +38,21 @@ def test_open_public_room_list_over_federation(self):
3838
"/_matrix/federation/v1/publicRooms",
3939
)
4040
self.assertEqual(200, channel.code)
41+
42+
@DEBUG
43+
def test_edu_debugging_doesnt_explode(self):
44+
"""Sanity check incoming federation succeeds with `synapse.debug_8631` enabled.
45+
46+
Remove this when we strip out issue_8631_logger.
47+
"""
48+
channel = self.make_signed_federation_request(
49+
"PUT",
50+
"/_matrix/federation/v1/send/txn_id_1234/",
51+
content={
52+
"edus": [
53+
{"edu_type": "m.device_list_update", "content": {"foo": "bar"}}
54+
],
55+
"pdus": [],
56+
},
57+
)
58+
self.assertEqual(200, channel.code)

0 commit comments

Comments
 (0)