RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
40.38k stars 10.49k forks source link

Encrypted channels do not encrypt messages in database #33686

Open kinvaris opened 1 day ago

kinvaris commented 1 day ago

Description:

When enabling E2E encryption, I expect the messages send in a encrypted channel to be encrypted from start to finish. Fetching them from the database, encrypted, shipping them to the client and decrypting them on arrival or somewhere on the way. Not stored in plain text in the database.

Steps to reproduce:

Create a encrypted channel and put some messages inside the channel

image

Expected behavior:

Messages to be encrypted in the database

See docs: https://docs.rocket.chat/docs/e2e-encryption

Actual behavior:

Messages are stored in plain text for some reason?

  {
    _id: 'fAZw2ATh5Fkx4cjKA',
    rid: '67160cdd55aaa39875b4596a',
    msg: 'this is a encrypted message',
    ts: ISODate('2024-10-21T08:12:45.388Z'),
    u: {
      _id: 'X7ZSLm7umWPBNaDxT',
      username: '<username>',
      name: '<full name of user>'
    },
    _updatedAt: ISODate('2024-10-21T08:12:45.447Z'),
    urls: [],
    mentions: [],
    channels: [],
    md: [
      {
        type: 'PARAGRAPH',
        value: [
          { type: 'PLAIN_TEXT', value: 'this is a encrypted message' }
        ]
      }
    ]
  }

Server Setup Information:

Client Setup Information

Relevant logs:

None of major significance

reetp commented 19 hours ago

First note the warnings:

IMPORTANT: E2E encryption functionality is currently in beta and includes notable restrictions that workspace owners should carefully consider before activating this feature for production use

Next, I am not sure what you have done but I don't believe that room is encrypted.

See the image here under 'FAQ'

https://docs.rocket.chat/v1/docs/end-to-end-encryption-user-guide

There should be a key to indicate the room is encrypted and I think there should be a key next to encrypted messages as well.

You might want to check the settings for E2E:

/admin/settings/E2E Encryption

eg

Unencrypted messages in encrypted rooms Allow plain text messages to be sent in encrypted rooms. These messages will not be encrypted.

Also note that first, you are on an outdated version of 6.12.x and should upgrade rather urgently, and second when testing you should be doing so on the latest code as per the bug template and links:

https://developer.rocket.chat/docs/contribute-through-bug-reporting