Nheko-Reborn / nheko

Desktop client for Matrix using Qt and C++20.
https://nheko-reborn.github.io/
GNU General Public License v3.0
1.95k stars 201 forks source link

devices with no curve25519 key are shown without a yellow or green shield icon #1768

Open foresto opened 4 months ago

foresto commented 4 months ago

Describe the bug

If a device is created without a curve25519 key, Nheko doesn't show a yellow shield next to it to warn the user that it is unverified, and doesn't show a green shield once it has been verified.

This behavior differs from Element Web, which shows red and green shields for such devices.

This might seem like an unusual case given that most devices are chat apps. However, a very simple device, like an account monitor bot that doesn't touch encrypted messages, has no need of a curve25519 key. It can do its job without one (thereby minimizing code complexity) and can be manually verified as long as it has an ed25519 key. It's also conceivable that an attacker might take advantage of this by omitting the curve25519 key in order to avoid attention.

It would be nice if Nheko's yellow and green shield icons appeared for these devices, both to warn the user if a device is a sneaky impostor, and to assure the user if the device is legit and its public key has been signed.

I also noticed that Nheko's doesn't show the yellow "please verify your other devices" banner for such devices.

To Reproduce

  1. Use the Matrix API to create a device with an ed25519 key but no curve25519 key.
  2. Log in as that device.
  3. Look for a yellow shield warning of an unverified device in Nheko.
  4. Manually verify the device (either through fingerprint verification or by using the API to self-sign its public key).
  5. Look for a green shield acknowledging a verified device in Nheko.

What happened?

Nheko doesn't show any shield icons for the device.

Expected behavior

A yellow or green shield icon next to the device, indicating whether it is verified.

Screenshots

No response

Version

0.12.0 flatpak

Operating system

Linux

Installation method

Local build

Qt version

5.15.8

C++ compiler

No response

Desktop Environment

Plasma 5.27.5

Did you use profiles?

Relevant log output

[crypto] [warning] Device key has no curve25519 or ed25519 key  @username:example.org:ABCDEFGHIJ

Backtrace

No response

deepbluev7 commented 3 months ago

We don't really support devices without curve keys and for that reason also won't allow verifying them. But we need to verify, that those devices also don't receive any e2ee messages. While your bot might not want to support uploading both keys, we don't really want to make our crypto code work with partial devices. That is far too much of a slippery slope and has way more complexity than uploading both of those keys and never touching them again.

foresto commented 3 months ago

uploading both of those keys and never touching them again.

That is, in fact, what my bot does in practice. I discovered the only-one-key situation during development.

We don't really support devices without curve keys and for that reason also won't allow verifying them.

Fair enough. But in that case, shouldn't Nheko warn the user that such a device is present, and show an appropriately colored shield icon next to it?