Enforce username rules on every account-creation path - #20
Merged
phulin merged 1 commit intoAug 16, 2026
Merged
Conversation
jackowayed
force-pushed
the
claude/username-validation-security-coua1g
branch
from
August 11, 2026 16:04
6b46199 to
e686221
Compare
Contributor
Author
Contributor
Author
|
oops meant to close the one on my fork |
Owner
|
can your claude resolve the conflict please? |
Username format rules (2-20 chars, [a-zA-Z0-9_] only) were enforced only
by POST /api/auth/username/check, which is advisory. The four paths that
actually insert users — email registration completion, OAuth completion,
and native Apple/Google sign-in — ran only the profanity filter, so a
300-character username containing HTML, newlines, and unicode was
accepted and stored.
Usernames are rendered directly into push notification bodies
("${user.username} sent you an Oy!"), so a stored username is attacker
-controlled lock-screen copy for anyone who receives an Oy.
validateUsername in lib.ts is now the single gate: length, character set,
and profanity. normalizeUsername (previously dead code) trims and
lowercases, matching how usernames are stored and looked up. Both are
applied at each creation path, and the check endpoint now delegates to
the same function so advisory results match what creation accepts.
Also removes fetchUserByUsername, which had no callers.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PvpccXvmDzszQ1fCJnaChX
Co-authored-by: jackowayed <18899+jackowayed@users.noreply.github.com>
jackowayed
force-pushed
the
claude/username-validation-security-coua1g
branch
from
August 16, 2026 13:42
e686221 to
af4350b
Compare
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.
Username format rules (2-20 chars, [a-zA-Z0-9_] only) were enforced only by POST /api/auth/username/check, which is advisory. The four paths that actually insert users — email registration completion, OAuth completion, and native Apple/Google sign-in — ran only the profanity filter, so a 300-character username containing HTML, newlines, and unicode was accepted and stored.
Usernames are rendered directly into push notification bodies ("${user.username} sent you an Oy!"), so a stored username is attacker -controlled lock-screen copy for anyone who receives an Oy.
validateUsername in lib.ts is now the single gate: length, character set, and profanity. normalizeUsername (previously dead code) trims and lowercases, matching how usernames are stored and looked up. Both are applied at each creation path, and the check endpoint now delegates to the same function so advisory results match what creation accepts.
Also removes fetchUserByUsername, which had no callers.
Claude-Session: https://claude.ai/code/session_01PvpccXvmDzszQ1fCJnaChX