fix(backend): handle malformed emails in PII masking

Prevents IndexError when email has empty local part (e.g., "@example.com").

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Nicholas Tindle
2026-02-08 21:56:49 -06:00
parent 3b6f1a4591
commit e688f4003e

View File

@@ -2139,7 +2139,10 @@ async def add_user_to_waitlist(
data={"unaffiliatedEmailUsers": current_emails},
)
# Mask email for logging to avoid PII exposure
masked = email.split("@")[0][0] + "***@" + email.split("@")[1] if "@" in email else "***"
parts = email.split("@") if "@" in email else []
local = parts[0] if len(parts) > 0 else ""
domain = parts[1] if len(parts) > 1 else "unknown"
masked = (local[0] if local else "?") + "***@" + domain
logger.info(f"Email {masked} added to waitlist {waitlist_id}")
else:
logger.debug(f"Email already exists on waitlist {waitlist_id}")