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

ValueError if someone writes to admin group without being part of the admin group from the bot's perspective #68

Open
missytake opened this issue Dec 16, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@missytake
Copy link
Contributor

expected behavior:

if the bot missed a vg-member-added message, and the member who the bot doesn't recognize writes to the group, it should complain with a message like "I don't see as part of the group - please re-add them if they can be trusted."

actual behavior:

If the bot missed a vg-member-added message, and the added member writes to the admin group, the bot crashes:

176651.47 [events-bot] DC_EVENT_INFO data1=0 data2=src/imap/idle.rs:76: INBOX: Idle-wait timeout or interruption                                                                                                                             
176651.47 [events-bot] DC_EVENT_INFO data1=0 data2=src/job.rs:350: loading job                                                                                                                                                               
176651.48 [events-bot] DC_EVENT_INFO data1=0 data2=src/imap.rs:905: 0 mails read from "INBOX".                                                                                                                                               
176651.48 [events-bot] DC_EVENT_INCOMING_MSG_BUNCH data1=0 data2=0                                                                                                                                                                           
176651.48 [events-bot] DC_EVENT_INFO data1=0 data2=src/imap/scan_folders.rs:28: Starting full folder scan                                                                                                                                    
176651.55 [events-bot] DC_EVENT_CONNECTIVITY_CHANGED data1=0 data2=0                                                                                                                                                                         
176651.56 [events-bot] DC_EVENT_INFO data1=0 data2=src/receive_imf.rs:99: Receiving message, seen=false...                                                                                                                                   
176651.60 [events-bot] DC_EVENT_INFO data1=0 data2=src/decrypt.rs:46: Detected Autocrypt-mime message                                                                                                                                        
176651.61 [events-bot] DC_EVENT_WARNING data1=0 data2=src/mimeparser.rs:311: decryption failed: missing key                                                                                                                                  
176651.61 [events-bot] DC_EVENT_INFO data1=0 data2=src/receive_imf.rs:121: received message has Message-Id: [email protected]                                                                                           
176651.62 [events-bot] DC_EVENT_INFO data1=0 data2=src/receive_imf.rs:1375: Assigning message to Chat#15 as it's a reply to [email protected]                                                                        
176651.62 [events-bot] DC_EVENT_WARNING data1=0 data2=src/receive_imf.rs:974: verification problem: This message is not encrypted.                                                                                                           
176651.63 [events-bot] DC_EVENT_INFO data1=0 data2=src/receive_imf.rs:1217: Message has 1 parts and is assigned to chat #Chat#15.                                                                                                            
176651.65 [events-bot] DC_EVENT_INFO data1=0 data2=src/contact.rs:1518: Recently seen loop waiting for 0h 5m 36s or interupt                                                                                                                 
176651.65 [events-bot] DC_EVENT_INCOMING_MSG data1=15 data2=51                                                                                                                                                                               
process_incoming message: [This message is not encrypted.. See 'Info' for more details]                                                                                                                                                      
The admin group is broken. Try `mailadm setup-bot`. Group ID: 15                                                                                                                                                                             
176651.69 [events-bot] call ac_incoming_message kwargs={'message': <Message incoming sys=False '[This mess' id=51 sender=10/[email protected] chat=15/Admin group on example.org>} failed                                             
Exception                                                                                                                                                                                                                                    
Traceback:                                                                                                                                                                                                                                   
Traceback (most recent call last):                                                                                                                                                                                                           
  File "/usr/lib/python3.9/site-packages/deltachat/events.py", line 268, in swallow_and_log_exception                                                                                                                                        
    yield                                                                                                                                                                                                                                    
  File "/usr/lib/python3.9/site-packages/deltachat/events.py", line 263, in _inner_run                                                                                                                                                       
    hook(**kwargs)                                                                                                                                                                                                                           
  File "/usr/lib/python3.9/site-packages/pluggy/_hooks.py", line 265, in __call__                                                                                                                                                            
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)                                                                                                                                                              
  File "/usr/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec                                                                                                                                                          
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)                                                                                                                                                                     
  File "/usr/lib/python3.9/site-packages/pluggy/_callers.py", line 60, in _multicall                                                                                                                                                         
    return outcome.get_result()                                                                                                                                                                                                              
  File "/usr/lib/python3.9/site-packages/pluggy/_result.py", line 60, in get_result                                                                                                                                                          
    raise ex[1].with_traceback(ex[2])                                                                                                                                                                                                        
  File "/usr/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall                                                                                                                                                         
    res = hook_impl.function(*args)                                                                                                                                                                                                          
  File "/usr/lib/python3.9/site-packages/mailadm/bot.py", line 46, in ac_incoming_message                                                                                                                                                    
    if not self.is_admin_group_message(message):                                                                                                                                                                                             
  File "/usr/lib/python3.9/site-packages/mailadm/bot.py", line 146, in is_admin_group_message                                                                                                                                                
    raise ValueError                                                                                                                                                                                                                         
ValueError                                                                                                                                                                                                                                   
@missytake missytake changed the title ValueError if someone writes to admin group without being part of the group ValueError if someone writes to admin group without being part of the admin group from the bot's perspective Dec 16, 2022
@missytake missytake added the bug Something isn't working label Dec 30, 2022
@link2xt
Copy link
Contributor

link2xt commented Jan 29, 2023

I think proper solution for this should start with removing raise ValueError. The bot should not crash (together with a web server by the way) due to encryption problems.

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