Files
orangecat/scripts/db
GandMao Nakamoto 8bc3cc5ba6 fix(messages,privacy): stop the People Picker from republishing email-derived handles (#854)
Visitor feedback on /messages: the New Message picker's default
suggestion list showed accounts like "georgy.butaev+ocauth1
@georgy.butaev+ocauth1" — real email local-parts published as public
handles, visible to any logged-in user. This is the leak fixed at the
two known signup paths in 20260826130000_stop_deriving_usernames_from_email.sql
and ProfileServerService.ensureProfile() — but not every account is
through the (deliberately manual, not-automatic) backfill script yet,
and two more write paths still minted the same leak independently:

- scripts/db/setup-db.ts hardcodes a sign-in as butaeff@gmail.com and
  upserts username: email.split('@')[0] on every run — almost
  certainly the actual source of the "+ocauth1"/"+ocauth2" test
  accounts in the report (butaeff is one of them).
- scripts/db/reset-user-password.js upserts username: email verbatim
  (the full address, not just the local part) for its fixture account.

Both now use the same neutral-username shape as the fixed paths
(neutralUsernameFor in the .ts script; the equivalent inlined in the
plain .js one, which can't import it).

For accounts already leaked and not yet backfilled: added
isEmailDerivedHandle() (src/config/public-directory.ts, same predicate
and .invalid exception as the SQL side's count_email_derived_usernames())
and wired it into GET /api/profiles to hide a still-leaking handle from
the *default* (no search term) suggestion list — the surface this was
reported from. An explicit search still finds the person; this isn't a
substitute for renaming their handle, which needs
scripts/rename-email-derived-usernames.sql run against production by
someone with DB access (noted in the session handoff, not in scope for
this dispatch — no live Supabase credentials in this sandbox).

Also: NewConversationModal's picker row showed name and @username
duplicated whenever a profile has no display name (title already falls
back to the handle) — pure noise, worse on narrow screens where both
lines truncate. Now the @handle line only renders when it adds
information beyond the title.

Co-authored-by: Mao Nakamoto <maonakamoto@users.noreply.github.com>
2026-08-30 01:16:20 +00:00
..