Skip to content

Problem with email change workflow #5618

Open

Description

@rolurq

Issue Description

There's a problem in the current way parse handles email changes for users. The problem is that when an user changes his email, parse sends a verification email, but changes the user email in the database, this can lead to a malicious access block from an user to another.

If a user changes his email to one not being used yet (which he can know by trying to change the email and not receiving the 'Email address already in use') then, without needing to verify the new one, the email address is changed, preventing the person that really owns that address from registering because would get the 'Email address already in use' error.

This error is prevented easily by making the email address change along with the verification accept. At the same time the emailVerified value is set to true so will be for the new email address. If the person that changed the email, owns the new address, then the verification can be performed successfully, if not, then the email wont be changed and the user owning the email address can register without problem.

Steps to reproduce

With a registered account perform an user email change to an email that's not registered yet. Then, try to register with that email.

Expected Results

That the registration succeeds as the other email change is not verified.

Actual Outcome

The registration fails with 'Email address already in use'

Environment Setup

  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : 3.1.3
    • Operating System: Linux Ubuntu 18.10
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): both
  • Database

    • MongoDB version: 3.4.4
    • Storage engine: default
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): both

Activity

  1. acinader commented on May 28, 2019

    @acinader
    Contributor

    Hi @rolurq

    Thanks for the issue. Something similar has been discussed and it appears that there has been a pr opened and worked on extensively.

    #5147

    The issue is valid and it would be nice to have a solid, covered solution out of the box.

    Are you interested in reviewing the closed bug and the pr to get the ball rolling?

  2. rolurq commented on May 28, 2019

    @rolurq
    Author

    @acinader
    Yeah, sure
    I tried finding a similar issue but it didn't show up the issue nor the pr you mentioned 😞

  3. added
    type:bugImpaired feature or lacking behavior that is likely assumed
    on Jul 6, 2019
  4. TomWFox commented on Jul 6, 2019

    @TomWFox
    Contributor

    @rolurq are you still working on this? - if not I’ll add the ‘up for grabs’ tag

  5. rolurq commented on Jul 8, 2019

    @rolurq
    Author

    @rolurq are you still working on this? - if not I’ll add the ‘up for grabs’ tag

    Not right now, I need it for my current project but as there are other essential features that I need to finish before, I'm not working on this right now. So please feel free to make it available for anyone to take the issue.

  6. acinader commented on Jul 8, 2019

    @acinader
    Contributor

    @rolurq the pr I mentioned is here: #5147

  7. dblythy commented on Sep 22, 2021

    @dblythy
    Member

    I'm not sure if this is still an issue. Users are free to sign up with any email, and existing users are free to change their email to whatever they like, providing it doesn't clash with existing users. We have test cases for emailVerified should be set to false after changing from an already verified email, which I think is enough.

  8. mtrezza commented on Sep 22, 2021

    @mtrezza
    Member

    It's an interesting scenario though. I guess the issue described here is that we remove the original (verified) email address before the user verified the new email address.

    What happens if a user can only change their email address from within an app, and they do that, but enter an incorrect email address, and then log out. They would not be able to verify the email address and not be able to log in because it's not verified?

  9. dblythy commented on Sep 22, 2021

    @dblythy
    Member

    Right, I understand. So the solution would be to not change the users' email until they have successfully verified it?

  10. mtrezza commented on Sep 22, 2021

    @mtrezza
    Member

    I think that was the suggested solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions