Skip to content

fix(account): handle single-word names in OIDC and GitHub auth providers#10631

Open
varaprasadreddy9676 wants to merge 1 commit intohcengineering:mainfrom
varaprasadreddy9676:fix/oidc-cjk-name
Open

fix(account): handle single-word names in OIDC and GitHub auth providers#10631
varaprasadreddy9676 wants to merge 1 commit intohcengineering:mainfrom
varaprasadreddy9676:fix/oidc-cjk-name

Conversation

@varaprasadreddy9676
Copy link
Contributor

@varaprasadreddy9676 varaprasadreddy9676 commented Mar 12, 2026

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 as undefined. This gets passed directly to the DB insert, causing a PostgreSQL NOT NULL constraint violation on last_name and a silent auth failure ("Not Found" page for the user).

Changes

  • pods/authProviders/src/openid.ts: Prefer standard OIDC given_name/family_name claims (available when profile scope is requested) when available; fall back to splitting name using parts[0] / parts.slice(1).join(' ') so last name is always a string
  • pods/authProviders/src/github.ts: Same slice(1).join(' ') fix for GitHub's displayName
  • server/account/src/utils.ts: Add ?? '' defensive fallback in loginOrSignUpWithProvider at the insertOne call — mirrors the existing pattern in signUpByGrant (line 720)

Test plan

  • OIDC login with a single-word CJK name (e.g. "西门吹雪") creates user with first_name="西门吹雪", last_name=""
  • OIDC login with a multi-word Western name (e.g. "Jean Claude") still splits correctly: first="Jean", last="Claude"
  • OIDC login with an IdP that provides given_name/family_name claims uses those directly
  • GitHub login with a single-word username/display name creates user correctly
  • Existing OIDC and GitHub auth flows unaffected

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>
@huly-github-staging
Copy link

Connected to Huly®: UBERF-15857

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant