fix(contracts): enforce password complexity requirements on update endpoint (@d1rshan)#7977
Open
d1rshan wants to merge 2 commits into
Open
fix(contracts): enforce password complexity requirements on update endpoint (@d1rshan)#7977d1rshan wants to merge 2 commits into
d1rshan wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR aligns the update-password request contract and controller tests with a shared PasswordSchema, enabling stronger/centralized password validation rules.
Changes:
- Replaced inline
z.string().min(6)validation withPasswordSchemaforUpdatePasswordRequestSchema. - Updated user controller password-update tests to use a password that meets the new complexity requirements.
- Updated expected validation error messages for invalid password submissions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/contracts/src/users.ts | Switches update-password validation to the shared PasswordSchema contract. |
| backend/tests/api/controllers/user.spec.ts | Updates test inputs and expected validation errors to match the new password policy. |
Member
|
Afair the password is still validated by the firebase rules, but it doesnt hurt to check on our api as well |
fehmer
approved these changes
May 20, 2026
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.
The backend
UpdatePasswordRequestSchemaonly enforcedz.string().min(6), while the frontendPasswordSchemarequires min 8, max 64, uppercase, number, and special character. This allowed weak passwords to be set via direct API calls, bypassing frontend validation.Updated the backend contract to use
PasswordSchemafrom@monkeytype/schemas/users, ensuring consistent validation across frontend and backend.