LOC-8 Do not throw exception if message cannot be decrypted
If a user connects into a room using a different encryption key to everyone else, do not let them effectively DoS the room by causing exceptions in everyone else's clients.
If we receive a message that cannot be decrypted, we simply print a warning to that effect and carry on.
Because the sending user's name is in the encrypted payload, we can't ascertain who sent it - but as soon as someone else replies, that sending user will also get an error message.
@@ -71,7 +71,13 @@
# Otherwise, process the messages
for i in resp["messages"]:
self.last = i
- msgbody = json.loads(self.decrypt(i))
+ msgbody = json.loads(self.decrypt(i))
+ # Means an invalid message was received - LOC-8
+ to_print.append(['error','Received message which could not be decrypted'])
# TODO - We'll need to json decode and extract the sending user's name
# but not currently including that info in my curl tests. Also means test that part of the next block