Signal-Android icon indicating copy to clipboard operation
Signal-Android copied to clipboard

Attempts to send "encrypted" IM to non-Signal contact

Open i7u opened this issue 11 years ago • 21 comments

I've been using TextSecure/Signal for years, as a result I use Signal to manage both my SMS and encrypted conversations.

In a SMS-only conversation with someone who has never used Signal, the app appears to have been temporarily confused into thinking that my friend was on Signal. It therefore attempted to send him an encrypted IM over data, which failed. I got the "some issues need your attention" message, in which "resend" always fails - the only way out is to ignore this failed message, copy/paste the contents into a new message and send over SMS.

I have screenshots if they would be of assistance, showing the lock icon in that one failed message in an otherwise pure SMS thread.

Debug log: https://gist.github.com/d0e12dcb2ee59b8eca7c

i7u avatar Nov 30 '15 11:11 i7u

Just for clarity, you're sure this contact never had signal installed?

moxie0 avatar Nov 30 '15 16:11 moxie0

I cannot be certain as I don't own the phone/SIM, but would be seriously surprised if they ever had.

I've been exchanging SMS over the past 6 months with this completely non-techie individual. I only use TextSecure/Signal on my phone to handle SMS so had he registered with Signal, I would have noticed. Also, Signal on my phone switched back to only offering the option to "Send unsecured SMS" to this contact immediately after this incident. It does feel like a fluke.

i7u avatar Nov 30 '15 16:11 i7u

Why not give the sender an option to use encrypted or SMS similar to Google hangouts?

z01L avatar Dec 02 '15 08:12 z01L

@z0l2k Long-pressing the send/attachement button opens this possibility.

mawed avatar Dec 02 '15 09:12 mawed

This is not about user options, the bug is that the app incorrectly thought that my contact was on Signal and dispatched an encrypted message (the status of which immediately became "Not delivered"). Straight after this the app realized that the contact was NOT on Signal and defaulted to SMS once more.

i7u avatar Dec 05 '15 21:12 i7u

I described a similar behaviour in #5027 yesterday. It was closed as it is very likely related to #4932. This issue here could also be connected to #4932.

FeuRenard avatar Jan 06 '16 12:01 FeuRenard

@FeuRenard Were you able to find out the exact steps that causes this issue (and #5027) consistently? I mean the steps I posted in https://github.com/WhisperSystems/Signal-Android/issues/4932#issuecomment-168653122 don't actually cause undelivered messages for me. I'm just guessing that the bug causing #4932 could be related to this but I don't know how to reproduce the behaviour that causes the exception in this issue and yours:

UndeliverableMessageException: Trying to send a secure SMS?

2-4601 avatar Jan 06 '16 12:01 2-4601

I only tried the steps in https://github.com/WhisperSystems/Signal-Android/issues/4932#issuecomment-168653122. Then I guessed the other way round could also work, but I was not able to test yet:

  1. Open conversation with Signal contact A
  2. Make sure the send mode is Signal message (you don't have to send anything)
  3. While you are in the conversation with A receive a SMS from non-Signal contact B
  4. Tap the notification to open the conversation with B
  5. Observe that the transport mode is Signal
  6. Try to send a message, which should fail.

And with 6 you should get the UndeliverableMessageException, I think. And if these steps work, my issue and this issue here could be explained.

FeuRenard avatar Jan 06 '16 13:01 FeuRenard

I tried those steps but on step 5 the transport mode was SMS. I continued to step 6 anyway and tried to send a message and it was sent as SMS as expected. So there was no bug. But it still could be related. I've just no idea how to reproduce :cold_sweat: :)

2-4601 avatar Jan 06 '16 13:01 2-4601

I also tried to reproduce my 6 steps and in step 2 I additionally changed the send method to SMS and then back to Signal. But in step 5 the transport mode was SMS, as expected.

I don't know, if it matters:

  • The incident in #5027 was my first encounter with that phone number. I did neither write with this number before, nor did I have it in my address book. No "Invite to Signal" popup.
  • I tried to reproduce the steps with a contact from my address book, that is not present in Signal (not registered and I never wrote SMS with it). "Invite to Signal" popup.
  • This issue here was produced with a contact from address book, that is present in Signal (SMS). No "Invite to Signal" popup, I guess, as it was closed earlier. ( @i7u ?)

Are the contacts maybe treated differently in this three cases? With which type did you try to reproduce, @2-4601 ?

FeuRenard avatar Jan 06 '16 21:01 FeuRenard

With which type did you try to reproduce

A number that was not saved in my address book.

2-4601 avatar Jan 06 '16 22:01 2-4601

  • I don't have a lock icon showing.
  • The text edit box says "Send unsecured SMS".
  • I do get an "Invite to Signal" pop-up.
  • The number is a system address book contact.
  • I hadn't received any Signal-routed messages since the day before.
  • I have another contact I can send SMS messages to.

lpar avatar Jan 25 '16 21:01 lpar

@lpar does this happen every time you try to send to this contact? Has this user been a TextSecure/Signal user in the past?

2-4601 avatar Jan 25 '16 22:01 2-4601

I'm pretty sure this contact has never been a Signal user.

I tried leaving Signal with a Signal-routed conversation open, and had a friend SMS me. I then selected the notification and replied (prompt "Send unsecured SMS") -- and it worked. So I don't think Signal is being confused by incoming SMS while you have a Signal chat open.

Then I tried deleting the contact history for the problem contact, then started a new chat. This time it worked.

So maybe it's to do with old conversation logs with legacy data that makes Signal think it should be using encrypted SMS. I'd suggest deleting chat history as a workaround, anyway.

lpar avatar Jan 25 '16 22:01 lpar

I encounter this issue regularly (not sure about always) if I reply to a SMS message using the notification window. Note: This person has never had Signal. Here is the relevant logcat:

02-03 12:21:26.920 32713-32734/org.thoughtcrime.securesms W/SmsSendJob: Sending message: 9525
02-03 12:21:26.920 32713-32734/org.thoughtcrime.securesms W/SmsSendJob: org.thoughtcrime.securesms.transport.UndeliverableMessageException: Trying to send a secure SMS?
                                                                            at org.thoughtcrime.securesms.jobs.SmsSendJob.deliver(SmsSendJob.java:82)
                                                                            at org.thoughtcrime.securesms.jobs.SmsSendJob.onSend(SmsSendJob.java:55)
                                                                            at org.thoughtcrime.securesms.jobs.SendJob.onRun(SendJob.java:43)
                                                                            at org.thoughtcrime.securesms.jobs.MasterSecretJob.onRun(MasterSecretJob.java:18)
                                                                            at org.whispersystems.jobqueue.JobConsumer.runJob(JobConsumer.java:76)
                                                                            at org.whispersystems.jobqueue.JobConsumer.run(JobConsumer.java:46)
02-03 12:21:26.920 32713-32734/org.thoughtcrime.securesms W/MessageDatabase: Updating ID: 9525 to base type: 24
02-03 12:21:26.921 32713-2974/org.thoughtcrime.securesms W/MessageDetailsActivity: Recipient is not a group, resolving members immediately.
02-03 12:21:26.938 32713-32734/org.thoughtcrime.securesms W/MmsSmsDatabase: Executing query: SELECT _id, unique_row_id, body, type, thread_id, address, address_device_id, subject, date_sent, date_received, m_type, msg_box, status, part_count, ct_l, tr_id, m_size, exp, st, delivery_receipt_count, mismatched_identities, network_failures, transport_type, attachment_id, unique_id, mid, data_size, _data, ct, cl, cd, name, pending_push FROM (SELECT DISTINCT date_sent AS date_sent, date AS date_received, _id, 'SMS::' || _id || '::' || date_sent AS unique_row_id, NULL AS attachment_id, body, read, thread_id, type, address, address_device_id, subject, NULL AS m_type, NULL AS msg_box, status, NULL AS part_count, NULL AS ct_l, NULL AS tr_id, NULL AS m_size, NULL AS exp, NULL AS st, delivery_receipt_count, mismatched_identities, NULL AS network_failures, 'sms' AS transport_type, NULL AS unique_id, NULL AS mid, NULL AS data_size, NULL AS _data, NULL AS ct, NULL AS cl, NULL AS cd, NULL AS name, NULL AS pending_push FROM sms WHERE (thread_id = 7) UNION ALL SELECT DISTINCT date AS date_sent, date_received AS date_received, mms._id AS _id, 'MMS::' || mms._id || '::' || date AS unique_row_id, part._id AS attachment_id, body, read, thread_id, NULL AS type, address, address_device_id, NULL AS subject, m_type, msg_box, NULL AS status, part_count, ct_l, tr_id, m_size, exp, st, delivery_receipt_count, mismatched_identities, network_failures, 'mms' AS transport_type, unique_id, NULL AS mid, data_size, NULL AS _data, ct, cl, cd, name, pending_push FROM mms LEFT OUTER JOIN part ON part._id =  (SELECT part._id FROM part WHERE part.mid = mms._id LIMIT 1) WHERE (thread_id = 7) ORDER BY date_received DESC LIMIT 1)
02-03 12:21:26.944 32713-32734/org.thoughtcrime.securesms W/PhoneNumberFormatter: Got local CC: US

The only solution is to go into the full Signal conversation, copy the message text, delete it, paste it back and resend.

13rac1 avatar Feb 03 '16 20:02 13rac1

@eosrei Full debug log captured immediately afterwards would be helpful, not much we can glean from that snippet.

moxie0 avatar Feb 03 '16 21:02 moxie0

@moxie0 I'm trying to figure out exactly how to reproduce this. I just sent myself SMS using Google Voice texts and notification replies work as designed. I'll capture it as it happens next time.

The above log happens when you attempt to resend the message, I should have been more clear. About the third time (YMMV!) you touch resend you realize there's a lock icon on the message and this person doesn't have Signal. It's not ideal UX, but even a snackbar or toast of the "Trying to send a secure SMS?" error would be more helpful than the current no-details instant fail.

13rac1 avatar Feb 03 '16 21:02 13rac1

I had the same problem happen with another contact I'd conversed with using a previous version of Signal. Once again deleting the conversation history and starting a new conversation made the problem go away. So I'm pretty sure it's related to legacy conversation history not being migrated properly to match expectations of the current code, at least in my case.

lpar avatar Feb 03 '16 21:02 lpar

@moxie0 It happened again! I think it's enough of the log. See here: https://gist.github.com/eosrei/5b70f99531e8930f51b5

This is inconsistent:

  1. Receive text message from non-Signal user.
  2. Open Signal using Notification
  3. Type text response and press send.
  4. Send errors
  5. Realize the person doesn't have Signal yet the secure call and secure text icons are shown
  6. Back out of the conversation activity
  7. Re-open the conversation and the person is now identified correctly.

Edit: I wrote two messages. Second was a test to confirm Signal would continue to attempt encrypted texts.

13rac1 avatar Feb 09 '16 20:02 13rac1

Happened again, different steps and still quite inconsistent:

  1. Share URL from a different app to Signal
  2. Opens user selection list
  3. Select non-Signal user
  4. User is identified as a Signal user and secure text is selected.

Debug log: https://gist.github.com/anonymous/06857df7a0edb03c6362 I've looked at the code a bit, but still don't see what's causing this. Hopefully, additional debug logs can be of use.

13rac1 avatar Feb 22 '16 17:02 13rac1