[Backport 5.4.0] auth: Make username from email deduplication dotcom only #62760
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.
#60339 introduced a new behavior that would always add a random suffix to usernames that are derived from email addresses.
The reason behind it seems to be that on dotcom, emails are from various domains and there are a lot of duplicates usually, and a lot of names that trigger our suspiciousness detection, like me@sourcegraph.com or me@sgdev.org.
For customer instances, this is not a real risk, and because of historic reasons, we depend on the username to be exactly what was given by the auth provider, so that bitbucket server permission syncing can work.
So this change for customer instances caused #62676.
To simplify the fix for this and make sure it can land in the next patch release, I opted for making this dotcom specific for now, as that's the least invasive change we can make.
Closes #62676
Test plan:
Created a new SAML application in Okta dev and lined that to my local instance.
A new user for
erik@sourcegraph.com
on main was callederik-acbdef
after signup.On this branch, with everything reset to fresh, a new user for
erik@sourcegraph.com
is callederik
.This should fix the bitbucket perms syncing issue.
Backport 663a74a from #62747