]> nmode's Git Repositories - signal-cli/commitdiff
Trust address/uuid combination from unidentified sender certificate
authorAsamK <asamk@gmx.de>
Sun, 9 May 2021 17:48:51 +0000 (19:48 +0200)
committerAsamK <asamk@gmx.de>
Sun, 9 May 2021 17:48:51 +0000 (19:48 +0200)
lib/src/main/java/org/asamk/signal/manager/Manager.java

index 4abe1260383d9046d7515e8f6e20210e2ccf7a0a..8d480044436f888ab26b102c88048d64c1af7bac 100644 (file)
@@ -1839,6 +1839,7 @@ public class Manager implements Closeable {
 
             if (envelope.hasSource()) {
                 // Store uuid if we don't have it already
+                // address/uuid in envelope is sent by server
                 resolveRecipientTrusted(envelope.getSourceAddress());
             }
             final var notAGroupMember = isNotAGroupMember(envelope, content);
@@ -1848,6 +1849,11 @@ public class Manager implements Closeable {
                 } catch (Exception e) {
                     exception = e;
                 }
+                if (!envelope.hasSource() && content != null) {
+                    // Store uuid if we don't have it already
+                    // address/uuid is validated by unidentified sender certificate
+                    resolveRecipientTrusted(content.getSender());
+                }
                 var actions = handleMessage(envelope, content, ignoreAttachments);
                 if (exception instanceof ProtocolInvalidMessageException) {
                     final var sender = resolveRecipient(((ProtocolInvalidMessageException) exception).getSender());