Fix: Add maximum length validation for communityName and communityBio (issue #129)#144
Conversation
… (issue NexGenStudioDev#129) Adds maximum length constraints to Zod schemas: - communityName: max 100 characters (was unlimited) - communityBio: max 500 characters (was unlimited) Prevents oversized values from causing: - Layout corruption in UI elements (headers, sidebars, dropdowns) - Database storage bloat - Column width limit violations Provides clear validation error messages when limits are exceeded.
Program Attribution & Label RequestThis contribution is being made under NSoC'26 (Nexus Spring of Code 2026). Recommended LabelsTo help track and prioritize this work, I recommend adding the following labels to this PR:
These labels will help with:
Thank you for reviewing this PR! |
Issue Resolution SummaryFixes: #129 What This PR AddressesIssue #129 identified a validation vulnerability where the signup form schema accepted arbitrarily long strings for:
Solution ProvidedAdded reasonable maximum length constraints:
Testing StatusReady for testing:
All changes follow the Zod validation pattern already established in the codebase. |
There was a problem hiding this comment.
Code Review
This pull request updates the signupSchema in useSignupForm.ts by adding maximum length constraints to both communityName (maximum 100 characters) and communityBio (maximum 500 characters). The reviewer recommends trimming whitespace from these inputs before validation to prevent users from bypassing minimum length requirements with spaces or including accidental leading/trailing spaces.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| communityName: z.string().min(2, "Community name must be at least 2 characters").max(100, "Community name must not exceed 100 characters"), | ||
| communityBio: z.string().min(10, "Bio must be at least 10 characters").max(500, "Bio must not exceed 500 characters"), |
There was a problem hiding this comment.
It is recommended to trim whitespace from the input strings before validating their length. Without .trim(), users can bypass the minimum length requirements by entering spaces, or accidentally include leading/trailing spaces that count towards the maximum length limit.
| communityName: z.string().min(2, "Community name must be at least 2 characters").max(100, "Community name must not exceed 100 characters"), | |
| communityBio: z.string().min(10, "Bio must be at least 10 characters").max(500, "Bio must not exceed 500 characters"), | |
| communityName: z.string().trim().min(2, "Community name must be at least 2 characters").max(100, "Community name must not exceed 100 characters"), | |
| communityBio: z.string().trim().min(10, "Bio must be at least 10 characters").max(500, "Bio must not exceed 500 characters"), |
Summary
Adds maximum length validation constraints to the
communityNameandcommunityBiofields in the signup form schema. These fields previously had only minimum length requirements, allowing users to submit arbitrarily long strings that could cause UI layout issues, database storage bloat, and field overflow.Problem Statement
The signup schema in
src/features/Auth/v1/hooks/useSignupForm.tsvalidates input fields with only minimum length constraints:Without maximum length constraints:
Solution
Added maximum length constraints:
communityName: Limited to 100 characters (suitable for community header displays)communityBio: Limited to 500 characters (suitable for textarea display and database storage)These limits are:
Changes Made
File:
src/features/Auth/v1/hooks/useSignupForm.tsBefore:
After:
Testing
The changes can be tested by:
Frontend validation:
Bio validation:
Valid submissions:
Impact
Related Issues
Fixes #129