stormpath / express-stormpath

Build simple, secure web applications with Stormpath and Express!
http://docs.stormpath.com/nodejs/express/
Apache License 2.0
325 stars 106 forks source link

Automatic Account Linking with MultiTenancy #593

Closed oshalygin closed 7 years ago

oshalygin commented 7 years ago

I've tested this one a few times and it seems that it works fine without multi tenancy but with multi tenancy the link based on MATCHING PROPERTY does not work. I'm not sure where this is on the road map but if I'm doing something wrong please let me know, I'd love to update the config on my end :)

Replicating:

  1. Using the following settings on the organization: image

  2. These are the account stores in this organization image

  3. Creating an account in the SPCloud directory results in the following: image

  4. Later I come along in the application and create an account via social login. I get the following results in the Google directory: image

  5. Coming back to the SPCloud directory to see if the link persisted: image

There is likely a disconnect somewhere and I realize MT on subdomain is still fairly new. I looked through the codebase of express-stormpath and I don't see any reference to account linking. If it's there, I'm open to diving in further.

Thanks gents.

edjiang commented 7 years ago

Are you able to do this on an app w/o multi-tenancy? It was my impression that accounts wouldn't automatically link if you did it in this order, unless the email was verified.

The risk here is that an attacker could register for an email based account w/o verifing the email. The real user then signs in with social login, and goes into the attacker's account. Since the attacker knows the password from the sign up process, the attacker now has access to all of the user's data.

oshalygin commented 7 years ago

The other path doesn't seem to jive w/ MT either:

These are the options I used with the above scenario: image

edjiang commented 7 years ago

With the other path, it would probably only link when you log in with the social account a second time. The reason is that the cloud directory is always the 'master' directory in this scenario, so there's no account to link it to.

oshalygin commented 7 years ago

@edjiang you're right, after a bit of testing, the link is persisted after I log in again with the social account.

edjiang commented 7 years ago

Awesome! Glad you got it figured out =]