fix(account): handle single-word names in OIDC and GitHub auth providers#10631
Open
varaprasadreddy9676 wants to merge 1 commit intohcengineering:mainfrom
Open
fix(account): handle single-word names in OIDC and GitHub auth providers#10631varaprasadreddy9676 wants to merge 1 commit intohcengineering:mainfrom
varaprasadreddy9676 wants to merge 1 commit intohcengineering:mainfrom
Conversation
When a user's name has no spaces (common for CJK names like "西门吹雪"),
name.split(' ') returns a single-element array so the last name
destructures as undefined, causing a PostgreSQL NOT NULL constraint
violation on the last_name column.
- openid: prefer standard OIDC given_name/family_name claims when
available, fall back to splitting name with safe slice(1).join()
- github: same split fix using displayName ?? username
- loginOrSignUpWithProvider: add ?? '' defensive fallback at insertOne
to guard against any undefined last name reaching the DB
Fixes hcengineering#10628
Signed-off-by: SaiVaraprasad Medapati <varaprasadreddy9676@gmail.com>
|
Connected to Huly®: UBERF-15857 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes #10628
When a user's display name contains no spaces (common for CJK names like
"西门吹雪"),name.split(' ')returns a single-element array, so the last name destructures asundefined. This gets passed directly to the DB insert, causing a PostgreSQLNOT NULLconstraint violation onlast_nameand a silent auth failure ("Not Found" page for the user).Changes
pods/authProviders/src/openid.ts: Prefer standard OIDCgiven_name/family_nameclaims (available whenprofilescope is requested) when available; fall back to splittingnameusingparts[0]/parts.slice(1).join(' ')so last name is always astringpods/authProviders/src/github.ts: Sameslice(1).join(' ')fix for GitHub'sdisplayNameserver/account/src/utils.ts: Add?? ''defensive fallback inloginOrSignUpWithProviderat theinsertOnecall — mirrors the existing pattern insignUpByGrant(line 720)Test plan
"西门吹雪") creates user withfirst_name="西门吹雪",last_name="""Jean Claude") still splits correctly:first="Jean",last="Claude"given_name/family_nameclaims uses those directly