HomePhabricator
Diffusion Comm 8383596b0c9c

[identity] fix issues with capitalized usernames in users and reserved…

Description

[identity] fix issues with capitalized usernames in users and reserved usernames tables

Summary:
we have to store usernames in their original form and in their lowercase form in these two dynamodb tables because we need case-insensitive uniqueness checks and case-sensitive retrievals. if a user registered with the username "ashoat," we should allow that user to log in with "Ashoat," too. however, we should not allow a different user to register the username "Ashoat."

searched for all places where we use USERS_TABLE_USERNAME_ATTRIBUTE or RESERVED_USERNAMES_TABLE_PARTITION_KEY and checked whether we were doing a retrieval or uniqueness check
if we were doing a uniqueness check, i swapped out the attribute with the lowercase equivalent. i made sure we always write the lowercase username to DDB along with the original username.

would normally add @bartek here but he's on vacation

Test Plan:

  1. registered username pamela
  2. tried logging in with capitalized Pamela -> succeeded
  3. tried registering a new user Pamela -> failed
  4. registered a new user KidRock directly with local keyserver
  5. tried to log in with usingCSAT=true and username kidrock -> succeeded
  6. registered a new user tommylee directly with local keyserver
  7. tried to log in with usingCSAT=true and username TommyLee -> succeeded

Reviewers: ashoat, will, tomek

Reviewed By: will

Subscribers: bartek

Differential Revision: https://phab.comm.dev/D12704

Details