lantern icon indicating copy to clipboard operation
lantern copied to clipboard

Email address canonicalization (normalization)

Open leahxschmidt opened this issue 13 years ago • 18 comments

If you have a gmail account [email protected], you also have [email protected], and [email protected], and [email protected] and so on. You also have [email protected] for all foo. Should we canonicalize all gmail addresses? What about other addresses -- +extension is a standard feature of sendmail, so maybe we should just remove it?

Gmail also doesn't make it obvious which set of dots you were emailed at (you can see it by clicking a little arrow). I worry that someone will give out their address as [email protected], but log in using [email protected], then get confused when they have no invite.

So I vote for address canonicalization.

leahxschmidt avatar Feb 08 '13 18:02 leahxschmidt

Official Gmail blog post about this: http://gmailblog.blogspot.com/2008/03/2-hidden-ways-to-get-more-from-your.html

That said, this behavior is a quirk most users aren't aware of. And while Google may canonicalize addresses internally, if someone who registered [email protected] grants an app permission to access their address via Oauth, I'm guessing Google reports the address as "foo.bar" to the app and not "foobar". Given that, do they leave it up to each app to canonicalize email addresses based on this known behavior, or do they provide APIs that don't require wheel reinventing?

lanterndev avatar Feb 11 '13 15:02 lanterndev

I just checked, and it turns out that Google does report whatever set of dots you initially used via oauth. This means that if someone invites you with a different set of dots or plusses, you will never get the invite (since we see only the canonical address).

Idea: if you invite someone, they are likely to be someone already on your XMPP roster, since that is made up of your gmail contacts, right? So what if we simply use those contacts as source of the correct form of email address (using the known canonicalization rule to match).

Does that sound plausible?

leahxschmidt avatar Feb 11 '13 18:02 leahxschmidt

The invite UI already offers completions from the roster. The backend could do an additional check for the case that the user did not accept a completion for a roster contact and input a non-canonical form of her email just to be cheeky, but a more common (and unsolved by this proposal) case is probably inviting someone who's not on your roster with a non-canonical address.

lanterndev avatar Feb 11 '13 19:02 lanterndev

OK, what if we store invites in canonicalized form, and then look them up that way too?

leahxschmidt avatar Feb 11 '13 22:02 leahxschmidt

That makes sense for Gmail addresses. We should also see if this makes sense for non @gmail.com Google Talk accounts before applying to those too.

lanterndev avatar Feb 11 '13 23:02 lanterndev

Lantern-controller is also incorrectly being case-sensitive to email addresses. So if your email address is [email protected], and someone invites [email protected], the controller will not recognize [email protected] when you try to log in, because the case is different.

lanterndev avatar Jun 07 '13 20:06 lanterndev

Coming up more often in user testing. Marking for 0.21.4. I believe @aranhoide is taking a stab at this, but may want to coordinate with @leahxschmidt.

lanterndev avatar Jun 27 '13 19:06 lanterndev

skivvies scripsit: "That makes sense for Gmail addresses. We should also see if this makes sense for non @gmail.com Google Talk accounts before applying to those too."

I'll check this now; if someone has already done so, please stop me. :)

aranhoide avatar Jul 01 '13 21:07 aranhoide

Yahoo, for one, won't "canonicalize" out any periods or plus signs when receiving mail. I'll do these canonicalizations when saving @gmail.com userids (and convert all to lowercase). After that I'll run a RemoteAPI job to normalize all userids. We can also convert @googlemail.com$ -> gmail.com while we're at it. We may add further rules in a per need basis.

aranhoide avatar Jul 01 '13 21:07 aranhoide

I recently tested that [email protected] does successfully reach me at [email protected].

lanterndev avatar Jul 01 '13 23:07 lanterndev

Yeah, but in the XMPP case, using the wrong set of dots does not work. So we need to take some care here.

On Mon, Jul 1, 2013 at 7:30 PM, skivvies [email protected] wrote:

I recently tested that [email protected] does successfully reach me at [email protected].

— Reply to this email directly or view it on GitHubhttps://github.com/getlantern/lantern/issues/550#issuecomment-20317725 .

leahxschmidt avatar Jul 01 '13 23:07 leahxschmidt

OK, so to the extent that we want to be robust in the face of people inviting/friending friends with the wrong number of dots we need to canonicalize those userids at least for domains known to work like gmail.com to that effect. This probably includes all domains for which e-mail accounts are managed via Google Apps, but I don't suppose we have any way to detect that. So we'll need to add those domains manually whenever someone complains about this syndrome. A warning somewhere about this might help, but it might also confuse users and give them something extra to think about that will only apply to a vanishing minority of them (once we have handled gmail.com proper) anyway.

I don't know whether the lantern-controller uses the stored userid to build jabberids to send XMPP messages to. If it does, we need to store the right (user part of the) jabberid separately (for example, the first time we get a XMPP from a particular user).

Another question is: is there any reason why we should handle this in the client too? Or is it OK that only the controller is aware of this canonicalization? Right now I can't think of any reason to bother the client (and its user) with this. We may keep the list of Friends in whatever format the user provided, and canonicalize for comparison when updating Friends in the lantern-controller.

So the required changes would be:

Add a Datastore table/singleton record that keeps the set of domains known to perform gmail-like e-mail address mangling. Add a method in Dao to update (load, canonicalize ID, save new version, delete old one) existing users in a given domain, and run it as a job whenever a new e-mail mangling domain is identified.

Add a method to LanternControllerUtils to normalize e-mail addresses to LanternUser IDs. Use that in the lanterncontroller to find the userid corresponding to any received XMPP message (that is, lantern-controller needs some post-processing after calling LanternXMPPUtils.jidToUserId in lantern-common).

(Optional; see above) Add a xmppUserId to the LanternUser table. Populate it the first time someone signs in (so it can subsume the everSignedIn field). Use that whenever we want to send an XMPP message to that particular user, that is not in response to a XMPP message received from that user.

Sounds like a plan or am I missing something?

aranhoide avatar Jul 03 '13 00:07 aranhoide

In the client, if the user types in a friend's address with the wrong dots, it will just get sent up to the controller. If that friend ever logs in, they'll be treated by the client as a different user. If they are not on each others xmpp rosters (which is likely given that the wrong dots were typed manually), then our user will never know that their friend has the wrong dots. And if the controller tells the client, that's an information leak. So I think the client is as good as it gets.

As for the controller, as far as I know, it only ever sends XMPP messages in response to other XMPP messages, so that part should be good already. And the rest sounds fine too.

On Tue, Jul 2, 2013 at 8:00 PM, aranhoide [email protected] wrote:

OK, so to the extent that we want to be robust in the face of people inviting/friending friends with the wrong number of dots we need to canonicalize those userids at least for domains known to work like gmail.com to that effect. This probably includes all domains for which e-mail accounts are managed via Google Apps, but I don't suppose we have any way to detect that. So we'll need to add those domains manually whenever someone complains about this syndrome. A warning somewhere about this might help, but it might also confuse users and give them something extra to think about that will only apply to a vanishing minority of them (once we have handled gmail.com proper) anyway.

I don't know whether the lantern-controller uses the stored userid to build jabberids to send XMPP messages to. If it does, we need to store the right (user part of the) jabberid separately (for example, the first time we get a XMPP from a particular user).

Another question is: is there any reason why we should handle this in the client too? Or is it OK that only the controller is aware of this canonicalization? Right now I can't think of any reason to bother the client (and its user) with this. We may keep the list of Friends in whatever format the user provided, and canonicalize for comparison when updating Friends in the lantern-controller.

So the required changes would be:

Add a Datastore table/singleton record that keeps the set of domains known to perform gmail-like e-mail address mangling. Add a method in Dao to update (load, canonicalize ID, save new version, delete old one) existing users in a given domain, and run it as a job whenever a new e-mail mangling domain is identified.

Add a method to LanternControllerUtils to normalize e-mail addresses to LanternUser IDs. Use that in the lanterncontroller to find the userid corresponding to any received XMPP message (that is, lantern-controller needs some post-processing after calling LanternXMPPUtils.jidToUserId in lantern-common).

(Optional; see above) Add a xmppUserId to the LanternUser table. Populate it the first time someone signs in (so it can subsume the everSignedIn field). Use that whenever we want to send an XMPP message to that particular user, that is not in response to a XMPP message received from that user.

Sounds like a plan or am I missing something?

— Reply to this email directly or view it on GitHubhttps://github.com/getlantern/lantern/issues/550#issuecomment-20387485 .

leahxschmidt avatar Jul 03 '13 04:07 leahxschmidt

It would be totally reasonable to just not support wrong dots (and + extensions, if that's still on the table) if it adds a lot more pain. I think case insensitivity is really the major use case we need to support. Most gmail users with a dot in their address don't even realize the dots are insignificant.

On Wednesday, July 3, 2013, Leah X Schmidt wrote:

In the client, if the user types in a friend's address with the wrong dots, it will just get sent up to the controller. If that friend ever logs in, they'll be treated by the client as a different user. If they are not on each others xmpp rosters (which is likely given that the wrong dots were typed manually), then our user will never know that their friend has the wrong dots. And if the controller tells the client, that's an information leak. So I think the client is as good as it gets.

As for the controller, as far as I know, it only ever sends XMPP messages in response to other XMPP messages, so that part should be good already. And the rest sounds fine too.

On Tue, Jul 2, 2013 at 8:00 PM, aranhoide <[email protected]<javascript:_e({}, 'cvml', '[email protected]');>> wrote:

OK, so to the extent that we want to be robust in the face of people inviting/friending friends with the wrong number of dots we need to canonicalize those userids at least for domains known to work like gmail.com to that effect. This probably includes all domains for which e-mail accounts are managed via Google Apps, but I don't suppose we have any way to detect that. So we'll need to add those domains manually whenever someone complains about this syndrome. A warning somewhere about this might help, but it might also confuse users and give them something extra to think about that will only apply to a vanishing minority of them (once we have handled gmail.com proper) anyway.

I don't know whether the lantern-controller uses the stored userid to build jabberids to send XMPP messages to. If it does, we need to store the right (user part of the) jabberid separately (for example, the first time we get a XMPP from a particular user).

Another question is: is there any reason why we should handle this in the client too? Or is it OK that only the controller is aware of this canonicalization? Right now I can't think of any reason to bother the client (and its user) with this. We may keep the list of Friends in whatever format the user provided, and canonicalize for comparison when updating Friends in the lantern-controller.

So the required changes would be:

Add a Datastore table/singleton record that keeps the set of domains known to perform gmail-like e-mail address mangling. Add a method in Dao to update (load, canonicalize ID, save new version, delete old one) existing users in a given domain, and run it as a job whenever a new e-mail mangling domain is identified.

Add a method to LanternControllerUtils to normalize e-mail addresses to LanternUser IDs. Use that in the lanterncontroller to find the userid corresponding to any received XMPP message (that is, lantern-controller needs some post-processing after calling LanternXMPPUtils.jidToUserId in lantern-common).

(Optional; see above) Add a xmppUserId to the LanternUser table. Populate it the first time someone signs in (so it can subsume the everSignedIn field). Use that whenever we want to send an XMPP message to that particular user, that is not in response to a XMPP message received from that user.

Sounds like a plan or am I missing something?

— Reply to this email directly or view it on GitHub< https://github.com/getlantern/lantern/issues/550#issuecomment-20387485> .

— Reply to this email directly or view it on GitHubhttps://github.com/getlantern/lantern/issues/550#issuecomment-20395676 .

lanterndev avatar Jul 03 '13 12:07 lanterndev

Is there anything to do on this now? Can I close? Looks like @leahxschmidt merged a PR.

cholmes avatar Aug 22 '13 20:08 cholmes

There are still some potential normalization issues around +extension and e.mail.address.es@gmail, but I think we should probably not worry about it until it becomes a real issue.

On Thu, Aug 22, 2013 at 4:13 PM, Chris Holmes [email protected]:

Is there anything to do on this now? Can I close? Looks like @leahxschmidthttps://github.com/leahxschmidtmerged a PR.

— Reply to this email directly or view it on GitHubhttps://github.com/getlantern/lantern/issues/550#issuecomment-23121313 .

leahxschmidt avatar Aug 22 '13 23:08 leahxschmidt

Cool, closing. Can ticket individually if/when it becomes an issue.

cholmes avatar Aug 22 '13 23:08 cholmes

A quick note just in case this ever gets reopened: make sure we're handling #704 if and when we ever need to revisit this one, since it's essentially the same issue.

aranhoide avatar Dec 03 '13 17:12 aranhoide