From 416f61645707936c5d4ebf4908161b36dc3e412f Mon Sep 17 00:00:00 2001 From: Kyle Pope Date: Thu, 5 Mar 2026 20:30:27 +0800 Subject: [PATCH] Allow dots in umbral name validation (matches username regex) Username validation allows dots ([a-z0-9_.\-]+) but the connection search and umbral name validators used [a-zA-Z0-9_-] which rejected dots. This caused a 422 on any search for users with dots in their username (e.g. rca.account01), silently showing "User not found". Fixed regex in both connection.py schema and auth.py ProfileUpdate to include dots: [a-zA-Z0-9_.-] Co-Authored-By: Claude Opus 4.6 --- backend/app/schemas/auth.py | 4 ++-- backend/app/schemas/connection.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/app/schemas/auth.py b/backend/app/schemas/auth.py index bd77b97..ebb9a7e 100644 --- a/backend/app/schemas/auth.py +++ b/backend/app/schemas/auth.py @@ -182,8 +182,8 @@ class ProfileUpdate(BaseModel): import re if ' ' in v: raise ValueError('Umbral name must be a single word with no spaces') - if not re.match(r'^[a-zA-Z0-9_-]{3,50}$', v): - raise ValueError('Umbral name must be 3-50 alphanumeric characters, hyphens, or underscores') + if not re.match(r'^[a-zA-Z0-9_.-]{3,50}$', v): + raise ValueError('Umbral name must be 3-50 alphanumeric characters, dots, hyphens, or underscores') return v @field_validator("email") diff --git a/backend/app/schemas/connection.py b/backend/app/schemas/connection.py index 7489baf..01b5078 100644 --- a/backend/app/schemas/connection.py +++ b/backend/app/schemas/connection.py @@ -8,7 +8,7 @@ from datetime import datetime from pydantic import BaseModel, ConfigDict, Field, field_validator -_UMBRAL_NAME_RE = re.compile(r'^[a-zA-Z0-9_-]{3,50}$') +_UMBRAL_NAME_RE = re.compile(r'^[a-zA-Z0-9_.-]{3,50}$') class UmbralSearchRequest(BaseModel): @@ -19,7 +19,7 @@ class UmbralSearchRequest(BaseModel): @classmethod def validate_umbral_name(cls, v: str) -> str: if not _UMBRAL_NAME_RE.match(v): - raise ValueError('Umbral name must be 3-50 alphanumeric characters, hyphens, or underscores') + raise ValueError('Umbral name must be 3-50 alphanumeric characters, dots, hyphens, or underscores') return v @@ -36,7 +36,7 @@ class SendConnectionRequest(BaseModel): @classmethod def validate_umbral_name(cls, v: str) -> str: if not _UMBRAL_NAME_RE.match(v): - raise ValueError('Umbral name must be 3-50 alphanumeric characters, hyphens, or underscores') + raise ValueError('Umbral name must be 3-50 alphanumeric characters, dots, hyphens, or underscores') return v