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

Changing Phone Number doesn't work

Open tinloaf opened this issue 12 years ago • 18 comments

A friend and I try to chat via TextSecure. I am located in Germany, he is located in England. Because he is from Germany originally, he still had my German number without the international prefix in his phone book. Now, when I wrote him, he could not answer me.

Then, he changed my phone number in his address book to include the international prefix and he hit "Update Directory". Still, we cannot chat since TextSecure tries to use the number without the prefix.

I think two things are amiss here: First, when I send him a message, TextSecure should be able to answer regardless of the number he has in his phone book. I.e., TextSecure should see that the message came from a phone number +49 ... and answer to that number (potentially telling him that this is not the number associated with my contact, i.e. someone could be trying to spoof him).

Second, of course TextSecure should notice the change in telephone numbers and update the contact accordingly.

I think both could be solved if TextSecure just always used the numbers with international prefix. Since all users registered with the server (and used their international number with it), the international prefix is known and used during sync. Why not just use it?

tinloaf avatar Feb 26 '14 20:02 tinloaf

In the Chat window, the number of @tinloaf is still shown without any prefix, i.e. 0???? instead of +49???? like it should be (and is so in my address book). This persist even if I delete the thread and reopen a new conversation by choosing the +49 number.

The log confirms it tries to send with a +44 prefix whereas it should use +49

W/PushServiceSocket(25633): PUT  --  {"destination":"+44?????????","messages":[{"body":"??????????\u003d\u003d","destinationDeviceId":1,"destinationRegistrationId":???,"type":1}]}
W/PushTransport(25633): org.whispersystems.textsecure.push.UnregisteredUserException: org.whispersystems.textsecure.push.NotFoundException: Not found
W/PushTransport(25633):     at org.whispersystems.textsecure.push.PushServiceSocket.sendMessage(PushServiceSocket.java:98)
W/PushTransport(25633):     at org.thoughtcrime.securesms.transport.PushTransport.deliver(PushTransport.java:150)
W/PushTransport(25633):     at org.thoughtcrime.securesms.transport.PushTransport.deliver(PushTransport.java:128)
W/PushTransport(25633):     at org.thoughtcrime.securesms.transport.UniversalTransport.deliverGroupMessage(UniversalTransport.java:163)
W/PushTransport(25633):     at org.thoughtcrime.securesms.transport.UniversalTransport.deliver(UniversalTransport.java:107)
W/PushTransport(25633):     at org.thoughtcrime.securesms.service.MmsSender.handleSendMms(MmsSender.java:77)
W/PushTransport(25633):     at org.thoughtcrime.securesms.service.MmsSender.process(MmsSender.java:58)
W/PushTransport(25633):     at org.thoughtcrime.securesms.service.SendReceiveService$SendReceiveWorkItem.run(SendReceiveService.java:249)
W/PushTransport(25633):     at org.thoughtcrime.securesms.util.WorkerThread.run(WorkerThread.java:46)
W/PushTransport(25633): Caused by: org.whispersystems.textsecure.push.NotFoundException: Not found
W/PushTransport(25633):     at org.whispersystems.textsecure.push.PushServiceSocket.makeBaseRequest(PushServiceSocket.java:324)
W/PushTransport(25633):     at org.whispersystems.textsecure.push.PushServiceSocket.makeRequest(PushServiceSocket.java:286)
W/PushTransport(25633):     at org.whispersystems.textsecure.push.PushServiceSocket.sendMessage(PushServiceSocket.java:96)
W/PushTransport(25633):     ... 8 more

xhochy avatar Feb 26 '14 20:02 xhochy

Thanks for the report and the logcat. All addressing is done in E164 format, but if a number is in a user's address book without a country code, we have to assume that the country code for that number is implicitly the same country code as the number for the registered device.

Just to confirm, it sounds like you're saying that after switching the number to E164 format, it is still attempting to send with the old (incorrectly inferred) country code?

moxie0 avatar Feb 27 '14 04:02 moxie0

Yes, after switching to E164, it is still using the old inferred country code.

xhochy avatar Feb 27 '14 09:02 xhochy

Also, xhochy is not able to answer me (in group chat as well as in one-to-one-chat). So his TextSecure gets a message from +49.... , displays it, but when he answers, it goes to +44.... I think this is definitely broken.

xhochy, what name does it show in my messages to you? Does it resolve my name via your address book? In that case, although it "thinks" my number is +44.... , it shows the name of the guy with the number +49.... (which should also be a problem because you could be talking to the wrong guy...)

tinloaf avatar Feb 27 '14 12:02 tinloaf

OK, some further debugging revealed this:

1.) I appear twice in Xhochy's contact list. Both contacts have the correct number (+49...) beneath them. Only one has the green "Push Enabled"-Bar.

2.) If he presses this (the push-enabled) contact, TS goes to a conversation window having the wrong number (0...) in the title - and that does not work

My guess is: My old number (i.e. without +49) is stuck in the contact database and did not get updated when he changed my number. To be exact, he did not change my number, but delete my entry and create a new one with the new number.

tinloaf avatar Mar 01 '14 02:03 tinloaf

The conversation in #1255 made me think: If @xhochy was able to change the number TS sends the (push-)messages to by manipulating the SQLite database, anyone with access to that database could do that, meaning he could redirect messages. This wouldn't be awfully bad, since the messages are still encrypted with the right key, but anyway. @moxie0 TS MACs large parts of its database, shouldn't it do so with the canonical addresses, too?

tinloaf avatar Mar 31 '14 01:03 tinloaf

I am also seeing this issue. My father put in a number without the US area code and tried to send a SMS. It returned with an incorrect number of digits message.

Changing the number in the contact did not work. Deleting the conversation did not work. Deleting the conversation and the contact and then creating a new contact also did not work.

Currently he is unable to send messages to this number using text secure. He is able to receive messages from this individual.

haagar avatar Mar 31 '14 13:03 haagar

With a friend of mine happened exactly the same thing than with @haagar and @tinloaf.

In his contact list (localized at his mobile, not synchronized with Google Contacts etc.) my number was in format 87654321 (eight numbers). In some places in Brazil, was added a ninth digit, so my correct number became 987654321. In the moment my friend installed TextSecure (it was yesterday), my number was wrong (87654321). We were together in person, so I could check and perform tests by myself in his mobile. Made lots of experiments: change number, delete number, delete contact, create contact, duplicate contact with derivated numbers.

My deduction is that some parts of TextSecure updates correctly the number, so that in the main contact list I appeared with the new entry: "Leandro Salvador +5511987654321"... +55 = Brazil, 11 = area code, 987654321 = my mobile number. But, clicking over my contact to send me a message, in the message window, it appears: "Leandro Salvador 87654321". Freak, don't?

Testing, I created four "clones": LS1: +5511987654321 <-- perfect E164 format LS2: 987654321 <-- correct number which TS can handle correctly LS3: 87654321 <-- old number, means nothing now, but TS insists on keeping it LS4: 7654321 <-- completelly freak number, but TS deduces (incorrectly) that is my

All these four different contacts are the same contact for TextSecure, when sending a message: the same message window opens.

So, when I send him a message from my TextSecure, it arrives via SMS only, not encrypted, although, strangely, the lock appears closed for both of us. The DATA channel doesn't work in any sense. I can send SMS to him. He can not send me neither SMS or DATA: my number, after all, is not 87654321, but 987654321. When I send him a message, despite of it all, from my correct 987654321 (or +5511987654321, as you wish), the message appears correctly as having been sent by me in his TextSecure main window (the one with multiple contacts showing up). But he can not answer me, because within the message window (the one with multiple messages between he and me), my number remains incorrect.

Tryed to create a group with four TS users. Just me with this problematic number in the contact list of my friend. Everything works fine in the group, except, guess!: the messages from he to me doesn't works. From me to he, goes ok. From everybody to everybody, ok.

If prints could help, please let me know.

My bet is that there is some algorithm that reads and/or record the phone number from right to left. So, adding numbers on the left side of the existing number, creates some confusion in TextSecure that does not correctly update the contact number.

My 2 cents...

oiceberg avatar Apr 07 '14 21:04 oiceberg

@leandrosalvador @haagar @tinloaf @xhochy thanks so much for your detailed report. Given that the contact selection shows the right number but the conversation window does not, I've become highly suspicious of CanonicalAddressDatabase using Android's SQLite hidden PHONE_NUMBERS_EQUAL comparator to see if two numbers are equivalent...

mcginty avatar Apr 15 '14 00:04 mcginty

@mcginty glad to help! If you want me to do some more testing, please do not hesitate to do so. Last Saturday another friend of mine, with a old (wrong) number of mine (in style 87654321), installed TextSecure and happened the same thing: no matter what we do in his cell, my number is never updated to 987654321 or +5511987654321 (and, so, we can not change messages through TextSecure). Thanks for your attention Buddy!

oiceberg avatar Apr 15 '14 20:04 oiceberg

@haagar YES. I have the same issue. It's super annoying. It renders TextSecure unusable.

titankronos avatar Apr 16 '14 15:04 titankronos

EDIT: nevermind

mcginty avatar Apr 25 '14 00:04 mcginty

@mcginty be careful pushing changes to people with DB migrations in them.

On 04/24/2014 05:50 PM, Jake McGinty wrote:

Can you guys maybe pull #1426 https://github.com/WhisperSystems/TextSecure/pull/1426 if you have some extra time and let me know if it solves your problem?

— Reply to this email directly or view it on GitHub https://github.com/WhisperSystems/TextSecure/issues/791#issuecomment-41349437.

http://www.thoughtcrime.org

moxie0 avatar Apr 30 '14 15:04 moxie0

Just removed that comment, it was posted before there was a migration in the PR

mcginty avatar Apr 30 '14 16:04 mcginty

#1568 sounds like this is not fixed yet :( I hoped this would be fixed by avoiding this broken SQL function...

tinloaf avatar Jun 07 '14 10:06 tinloaf

I'm having the same problem here, I have a contact without E164 format, and I can only send messages to him using SMS (but he can send me messages using PUSH)

paulogeyer avatar Jun 10 '14 23:06 paulogeyer

What's the status on this issue?

titankronos avatar Jun 24 '14 14:06 titankronos

This could be fixed by #1426 once it gets in.

tinloaf avatar Jun 25 '14 08:06 tinloaf