OMEMO: KeyError if trust is NULL
Versions
- OS: Debian 11
- Gajim version: 1.3.1
- Plugin version: 2.7.15
- GTK version: 3.24.24
- Python-nbxmpp version: 2.0.2-1
Steps to reproduce the problem
- Maybe have a very old omemo_LOCALPART@DOMAIN.db where some of your own old (unused) keys have trust NULL in the table IDENTITIES
- try to talk to someone else with a yet unknown key.
Expected behavior
- popup with keys to choose to trust.
Actual behavior
- No popup opens to validate the key
- message get's sent anyway and can't be decrypted by the recipient.
- recipient answers, answer is encrypted but "untrusted"
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/gajim/plugins/pluginmanager.py", line 476, in _execute_all_handlers_of_gui_extension_point
handlers[0](*args)
File "/home/MYUSER/.local/share/gajim/plugins/omemo/plugin.py", line 238, in _on_encryption_button_clicked
self._show_fingerprint_window(chat_control)
File "/home/MYUSER/.local/share/gajim/plugins/omemo/plugin.py", line 313, in _show_fingerprint_window
KeyDialog(self, contact, transient,
File "/home/MYUSER/.local/share/gajim/plugins/omemo/gtk/key.py", line 102, in __init__
self.update()
File "/home/MYUSER/.local/share/gajim/plugins/omemo/gtk/key.py", line 139, in update
self._load_fingerprints(self._own_jid)
File "/home/MYUSER/.local/share/gajim/plugins/omemo/gtk/key.py", line 157, in _load_fingerprints
rows[result.public_key] = KeyRow(result.recipient_id,
File "/home/MYUSER/.local/share/gajim/plugins/omemo/gtk/key.py", line 250, in __init__
self._trust_button = TrustButton(self)
File "/home/MYUSER/.local/share/gajim/plugins/omemo/gtk/key.py", line 348, in __init__
self.update()
File "/home/MYUSER/.local/share/gajim/plugins/omemo/gtk/key.py", line 351, in update
icon_name, tooltip, css_class = TRUST_DATA[self._row.trust]
KeyError: None
This did not happen on another machine with the same OS/Gajim-Version.
After diging around, adding dirty print() in some lines, I found out that the KeyError was because of my own recipient_id, so I had a look in the sqlitedb. Some really old keys of my account had a trust of NULL (not found on the other machine). After deleteting those lines in the sqlitedb, gajim/omemo worked as expected.
So for me, on my machine this problem is solved. But maybe others might run in that problem too.