question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there a reason why creating an account with an email already registered doesn't return an error?

See original GitHub issue

Is there a reason why creating an account with an email already registered doesn’t return an error?

Update - more information

Running the following mutation multiple times with the same credentials always returns success.

mutation Register($input: RegisterCustomerInput!) {
  registerCustomerAccount(input: $input) {
    __typename
    ... on Success {
      success
    }
    ...ErrorResult
  }
}

fragment ErrorResult on ErrorResult {
  errorCode
  message
}

Here are the two cases I could think of:

  1. If the user registered, but has not yet verified his account. Any subsequent registration attempt with the same credentials returns success. Also, multiple verification emails are sent. If different passwords were specified during the registration attempts, the first one is the one recorded in the database. You could see how this might confuse customers.

  2. If the account is verified, any subsequent registration attempt returns success.

Looking at the error codes currently used, it seems like it should return:

  • EMAIL_ADDRESS_CONFLICT_ERROR for case (2)

  • Either EMAIL_ADDRESS_CONFLICT_ERROR or NOT_VERIFIED (subject to issue #500) for case (1), although I prefer the latter as it is more informative to the customer.

I’m now aware of commit b1ffa1e that makes the registration mutation silently fail to protect user data. You’re trading off extra security for customer experience. As a user, I often forget if I have an account on a particular website - especially if I don’t use it often. I’m curious to hear what you think.

_Originally posted by @marwand in https://github.com/vendure-ecommerce/vendure/issues/33#issuecomment-713831098_

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ssex-devcommented, May 18, 2022

Thank you very much for the fast reply! Ok I understand, I freaked out for a moment, sorry.

0reactions
michaelbromleycommented, Oct 10, 2022

@usama8800 this class of attack is known as an an enumeration attack - basically a way to extract data from the system which we don’t want to expose, e.g. all the email addresses of our customers. Good write-up on it here: https://www.upguard.com/blog/what-is-an-enumeration-attack

My proposal is this:

I think long-term, this behaviour should be configurable via a strategy (defaulting to current behaviour), but a strategy-based approach would allow merchants to make a judgement call on their usability/security tradeoff and even implement e.g. a rate-limiting mechanism to mitigate the security risk.

Read more comments on GitHub >

github_iconTop Results From Across the Web

An account is already registered with your email address ...
They will be faced by the following irritating error. An account is already registered with your email address. Please log in.
Read more >
What does the error "This email address is already used by ...
Answer. It is possible that this user has already been added as an end user. You must run a search to confirm if...
Read more >
Email Address is Already Registered | LinkedIn Help
If you get an error message that indicates that your email address is already in use it means the email address you've entered...
Read more >
Disclose to user if account exists?
An email is sent to that address, containing a one-time registration link; however, if the email is already registered, then an email is...
Read more >
rest - Which HTTP response code for "This email is already ...
If you return a 409 for account registration, you are just exposing a service for account enumeration. Depends on the application, if the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found