Repository navigation
fix: cap and type-check author display names - #8475
Conversation
CLIENT_READY and USERINFO_UPDATE stored userInfo.name with no type or length check, so an unauthenticated client could save a name of up to ~1 MB (bounded only by engine.io's maxHttpBufferSize) that was then sent to every client opening the pad via historicalAuthorData and USER_NEWINFO. A non-string name also broke the admin author search. Add AuthorManager.sanitizeAuthorName(): non-strings and blank strings become null, everything else is trimmed and cut to 128 code points. Apply it on write (both socket handlers, SUGGEST_USER_NAME, setAuthorName, createAuthor) and on read (historicalAuthorData, USER_NEWINFO, the joining client's own name, getAuthorName for chat), so records stored before the cap are not rebroadcast at full size. Match the cap with maxlength on the pad's name inputs. GHSA-w4w9-j4c3-hjf6 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TcYAoDMav4BPPE9JrMtSvw
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
PR Summary by QodoCap and type-check author display names
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Code Review by Qodo
1. Admin author search sends oversized names
|
Author display names sent over the pad socket (
CLIENT_READY,USERINFO_UPDATE) were stored with no type or length check, so a client could save a name close to 1 MB that was then sent to everyone who opened the pad. A non-string name also broke the admin author search.This adds
AuthorManager.sanitizeAuthorName(). It nulls non-strings and blank strings, then trims and caps the name at 128 code points. Any Unicode is accepted, and surrogate pairs are never split. The helper runs on write (socket handlers,SUGGEST_USER_NAME,setAuthorName,createAuthor) and on read (historicalAuthorData,USER_NEWINFO,getAuthorName,searchAuthors), so records stored before the cap aren't rebroadcast. The pad name inputs get a matchingmaxlength.Tests: new
authorNameCapspec (24 tests); the full backend suite passes locally.GHSA-w4w9-j4c3-hjf6, reported by @MAYASEVEN.
🤖 Generated with Claude Code
https://claude.ai/code/session_01TcYAoDMav4BPPE9JrMtSvw