feat: prevent account enumeration during registration #4480
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related issue(s)
Would partially resolve #133
Checklist
introduces a new feature.
contributing code guidelines.
vulnerability. If this pull request addresses a security vulnerability, I
confirm that I got the approval (please contact
[email protected]) from the maintainers to push
the changes.
works.
Further Comments
Currently, it is not possible to avoid account enumeration during the registration flow in Ory Kratos. This means users can attempt to register with an email and if they receive the "An account with the same identifier exists already" error message, they now know the account existed.
For some projects (including the one I'm working on), avoiding account enumeration is a product requirement, and so I've gone ahead and added this functionality into Ory Kratos.
Importantly, this is only enabled if security.account_enumeration.mitigate is set, otherwise the behavior is the same as before.
What changed? (if mitigation is enabled)
RegistrationDuplicate) to the user to inform them that their account already exists, and they can sign inidentityis no longer returnedsessionhook after verification flows. This way the user is still signed in, but only after verification (preventing enumeration).I know this is a big change, so happy to discuss the changes.