Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encrypted appservices can't decrypt event: decryption failed because the room key is missing #208

Closed
Half-Shot opened this issue Apr 21, 2022 · 4 comments · Fixed by #236 or matrix-org/synapse#13235
Assignees
Labels
bug Something isn't working e2ee Issue relating to encryption
Milestone

Comments

@Half-Shot
Copy link
Contributor

For whatever reason, the bridge never seems to sort out it's room keys.

INFO 22:21:24:094 [Appservice] Processing event of type m.room.encrypted
WARN 22:21:24:095 [Appservice] Bot client was not able to decrypt !YFBJGTnYoiyRzBXhlm:beefy $lSrPWwC3ZtgLbF13Bi7aCpzulOQyFJsriQ470USSdi4 - trying other intents
DEBUG 22:21:24:095 [MatrixHttpClient] (REQ-123) GET http://localhost:8008/_matrix/client/r0/rooms/!YFBJGTnYoiyRzBXhlm%3Abeefy/joined_members
ERROR 22:21:24:105 [Appservice] Decryption error on !YFBJGTnYoiyRzBXhlm:beefy $lSrPWwC3ZtgLbF13Bi7aCpzulOQyFJsriQ470USSdi4 Error: Decryption failed: decryption failed because the room key is missing
    at OlmMachine.decryptRoomEvent (/home/will/git/matrix-hookshot/node_modules/@turt2live/matrix-sdk-crypto-nodejs/src/ts/OlmMachine.ts:305:37)
    at CryptoClient.<anonymous> (/home/will/git/matrix-hookshot/node_modules/matrix-bot-sdk/lib/e2ee/CryptoClient.js:157:50)
    at Generator.next (<anonymous>)
    at /home/will/git/matrix-hookshot/node_modules/matrix-bot-sdk/lib/e2ee/CryptoClient.js:17:71
    at new Promise (<anonymous>)
    at __awaiter (/home/will/git/matrix-hookshot/node_modules/matrix-bot-sdk/lib/e2ee/CryptoClient.js:13:12)
    at CryptoClient.decryptRoomEvent (/home/will/git/matrix-hookshot/node_modules/matrix-bot-sdk/lib/e2ee/CryptoClient.js:156:16)
    at CryptoClient.descriptor.value (/home/will/git/matrix-hookshot/node_modules/matrix-bot-sdk/lib/e2ee/decorators.js:33:35)
    at Appservice.<anonymous> (/home/will/git/matrix-hookshot/node_modules/matrix-bot-sdk/lib/appservice/Appservice.js:540:83)
    at Generator.next (<anonymous>)
    at fulfilled (/home/will/git/matrix-hookshot/node_modules/matrix-bot-sdk/lib/appservice/Appservice.js:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  code: 'GenericFailure'
}

The appservice is configured to use crypto: https://github.com/matrix-org/matrix-hookshot/blob/ac761ba771fa4016882a1fc471f6eb0c20d8d661/src/appservice.ts#L5-L29

(have checked that the storage backend is indeed working)

The registration file has:

de.sorunome.msc2409.push_ephemeral: true
org.matrix.msc3202: true

Synapse has:

experimental_features:
  msc3202_device_masquerading: true
  msc3202_transaction_extensions: true
  msc2409_to_device_messages_enabled: true
@Half-Shot Half-Shot changed the title Encrypted bridges can't decrypt event: decryption failed because the room key is missing Encrypted appservices can't decrypt event: decryption failed because the room key is missing Apr 21, 2022
@turt2live turt2live added bug Something isn't working e2ee Issue relating to encryption labels May 30, 2022
@turt2live
Copy link
Owner

is it possible that the room key was sent before synapse's support was enabled?

@Half-Shot
Copy link
Contributor Author

Definitely not in this case. I created fresh rooms and accounts after enabling support.

@turt2live
Copy link
Owner

I think this might be caused by the crypto stack assuming client.on(...) will work, but it won't. Will need to figure this out.

@turt2live turt2live self-assigned this Jul 6, 2022
@turt2live turt2live added this to the v0.6.0 milestone Jul 6, 2022
@turt2live
Copy link
Owner

Blocked on #236

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working e2ee Issue relating to encryption
Projects
None yet
2 participants