matrix-org / pantalaimon

E2EE aware proxy daemon for matrix clients.
Apache License 2.0
279 stars 41 forks source link

_matrix/client/v3/sync room events not being decrypted #135

Closed TheSpookyElectric closed 1 year ago

TheSpookyElectric commented 1 year ago

Not entirely sure where the fault lies here; pantalaimon or synapse, but room events within _matrix/client/v3/sync are not being decrypted. This is working with _matrix/client/r0/sync

To Reproduce Steps to reproduce the behavior:

  1. Send a message to an encrypted room to create an event
  2. Send a curl command to your _matrix/client/v3/sync endpoint: http://localhost:8009/_matrix/client/v3/sync?access_token=TOKEN&since=BATCH_ID&filter=2

Result is: "device_one_time_keys_count": { "signed_curve25519": 0 }, "org.matrix.msc2732.device_unused_fallback_key_types": [], "device_unused_fallback_key_types": [], "rooms": { "join": { "!BYzTubQQzlTbRoZhSv:matrix.some.where": { "timeline": { "events": [ { "type": "m.room.encrypted", "sender": "@me:matrix.some.where", "content": { "algorithm": "m.megolm.v1.aes-sha2", "sender_key": "XXxxxxXXXXXxXxxXxXXXXXxxxxX", "ciphertext": "AwgOEqAB3v1s/aF5RJxDS5U7ClMi6g4LIetV/QRZL2fR0xtDOTWNpTaZ40rHw0z4A2yWe//uxn1G3mmkAA7F6WhQw2xrJCPwvennS72XzOQYrJDU31x7WZwekmF2qsw/unoTSAf+BmTObCmgswfSUiGjOGDlvuLaVkb2ABH57Ug1J5Pm/TVtTUDm/mITjs8qwgWTZj+SnlcQMVY+unDxSZG/Ii6NPBGAX5LeajPrK0VZCuhxm1Ou9nIdvN7QR7toSblysP1uGGSiPBCH41/0YKUzibumiXkETBGR9l+dYvVZfNIgGthBxWF3piQZDQ", "session_id": "5qRt2T7mvuP8opJt9ERU4TYiNhSy2lDVu+qm0w7iDNM", "device_id": "VJTBYNIDVQ" }, "origin_server_ts": 1660304547298, "unsigned": { "age": 241162 }, "event_id": "$kxn2FBAbJfQpGBS_4Weiir34y28rfbGVzgb6nDR9w3M" } ], "prev_batch": "s845401_23943932_1478_1145122_1382754_1385_571517_9960_0", "limited": false }, "state": { "events": [] }, "account_data": { "events": [] }, "ephemeral": { "events": [] }, "unread_notifications": { "notification_count": 0, "highlight_count": 0 }, "summary": {} } } }

  1. Make your changes to use r0 and login, send the same curl command to your _matrix/client/r0/sync endpoint:

Result is: "device_one_time_keys_count": { "signed_curve25519": 50 }, "org.matrix.msc2732.device_unused_fallback_key_types": [], "device_unused_fallback_key_types": [], "rooms": { "join": { "!BYzTubQQzlTbRoZhSv:matrix.some.where": { "timeline": { "events": [ { "type": "m.room.message", "sender": "@me:matrix.some.where", "content": { "org.matrix.msc1767.text": "test message", "body": "test message", "msgtype": "m.text" }, "origin_server_ts": 1660304547298, "unsigned": { "age": 254976 }, "event_id": "$kxn2FBAbJfQpGBS_4Weiir34y28rfbGVzgb6nDR9w3M", "room_id": "!BYzTubQQzlTbRoZhSv:matrix.some.where", "decrypted": true, "verified": false } ], "prev_batch": "s845401_23943939_1478_1145122_1382754_1385_571517_9960_0", "limited": false }, "state": { "events": [] }, "account_data": { "events": [] }, "ephemeral": { "events": [] }, "unread_notifications": { "notification_count": 0, "highlight_count": 0 }, "summary": {} } } } }

Ubuntu 20.04 Pantalaimon 0.10.4 Synapse Version: 1.64

Additional context: This behavior is seen with any version of Pantalaimon, so I'm not sure that it's actually the fault of Pantalaimon.

The only variable is the matrix API version r0 <-> v3

Only noticed this after a Synapse upgrade, so I can't say if the v3 endpoint works with an older Synapse

poljar commented 1 year ago

The v3 endpoinds are somewhat new, they have now been added to the list of requests that are handled by pantalaimon.

Should be fixed by #137.

TheSpookyElectric commented 1 year ago

Very nice!