Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

[Backport 5.4.5099] scim: Fix random suffix added to every user on resync#63131

Merged
DaedalusG merged 1 commit into5.4.5099from
backport-63122-to-5.4.5099
Jun 6, 2024
Merged

[Backport 5.4.5099] scim: Fix random suffix added to every user on resync#63131
DaedalusG merged 1 commit into5.4.5099from
backport-63122-to-5.4.5099

Conversation

@sourcegraph-release-bot
Copy link
Collaborator

In the current implementation, we check if there's a user in the database already, and if so we add a random suffix to increase the chances of the insert/update to succeed.

However, we didn't check if the user that already exists is the same user. So for a first sync, usernames would look nice and tidy, but then on a second sync from the SCIM provider, every user would get a suffix.

This PR fixes that by adding a check for the user ID.

Test plan:

Added tests, verified SCIM sync doesn't modify usernames anymore locally.
Backport 614375e from #63122

In the current implementation, we check if there's a user in the
database already, and if so we add a random suffix to increase the
chances of the insert/update to succeed.

However, we didn't check if the user that already exists is _the same
user_. So for a first sync, usernames would look nice and tidy, but then
on a second sync from the SCIM provider, every user would get a suffix.

This PR fixes that by adding a check for the user ID.

Test plan:

Added tests, verified SCIM sync doesn't modify usernames anymore
locally.

(cherry picked from commit 614375e)
@sourcegraph-release-bot sourcegraph-release-bot requested review from a team, DaedalusG and eseliger and removed request for a team June 6, 2024 17:28
@sourcegraph-release-bot sourcegraph-release-bot added cla-signed backports team/source Tickets under the purview of Source - the one Source to graph it all team/product-platform backported-to-5.4.5099 labels Jun 6, 2024
@DaedalusG DaedalusG enabled auto-merge (squash) June 6, 2024 17:30
@DaedalusG DaedalusG merged commit fd1fe42 into 5.4.5099 Jun 6, 2024
@DaedalusG DaedalusG deleted the backport-63122-to-5.4.5099 branch June 6, 2024 17:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backported-to-5.4.5099 backports cla-signed team/product-platform team/source Tickets under the purview of Source - the one Source to graph it all

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants