urBackend icon indicating copy to clipboard operation
urBackend copied to clipboard

feat(auth): enforce strong password validation for authentication flows

Open NAYAMATVISION opened this issue 6 months ago • 14 comments

Currently the authentication flow only validates passwords based on minimum length (6 characters). This allows weak passwords such as:

  • 123456
  • password
  • abcdef

to be accepted during signup and password reset flows.

Weak passwords can increase the risk of:

  • brute-force attacks
  • credential stuffing
  • poor account security

##Solution

Implement stronger password validation rules across authentication-related schemas.

Suggested requirements:

  • minimum length of 8 characters
  • at least one uppercase letter
  • at least one lowercase letter
  • at least one number
  • at least one special character

Example valid password:

MyPass@2026

An alternative approach could be integrating password strength estimation libraries such as zxcvbn, but initially a regex/Zod-based validation approach would be simpler and sufficient for improving baseline security.

This enhancement would improve authentication security and align password policies with common production-grade standards used in modern applications.

NAYAMATVISION avatar May 17 '26 09:05 NAYAMATVISION

Hi @yash-pouranik, I would like to work on this enhancement.

My planned approach is:

  • strengthen password validation rules in authentication schemas
  • enforce uppercase, lowercase, numeric, and special character requirements
  • improve validation error messages for better UX
  • add/update tests for valid and invalid password cases

Since this directly improves authentication security, I’d love to take this up.

NAYAMATVISION avatar May 17 '26 09:05 NAYAMATVISION

Okay so ur approach is good but thats basic? like a level 1 issue. but in last line of the issue description it suggests using zxcvbn library, If possible please use this and strengthen the password also, dont just update the backend but also update the frontend to handle different responses on UI as well. One more thing is you should add this on same login on frontend and on backend both side so that if we are using UI then not each submit goes to backend to check weather its strong or not but on UI itself its checked, this decreases network calls. and if using this library zxcvbn, if this is also available for frontend react then go for it.

let me know if any Qns??

assigning to you.

Also following this ethics will make it to level 2 or 3.

yash-pouranik avatar May 17 '26 09:05 yash-pouranik

Hi @yash-pouranik, I explored the current auth flow and drafted an implementation plan before starting development.

Planned approach:

  • use zxcvbn on both frontend and backend
  • create a reusable backend helper (validatePasswordStrength)
  • enforce password strength in signup, reset-password, and change-password flows
  • add a reusable PasswordStrengthMeter React component for real-time feedback
  • prevent weak password submissions on frontend itself to reduce unnecessary API calls
  • still keep backend validation as the authoritative security layer
  • reuse existing UI feedback conventions/styles as much as possible

I’m planning to keep minimum acceptable strength at zxcvbn score >= 2 to balance usability and security.

Please let me know if this approach looks good before I start implementing it.

NAYAMATVISION avatar May 20 '26 09:05 NAYAMATVISION

Yeah sure, You can start working.

yash-pouranik avatar May 20 '26 09:05 yash-pouranik

Hi @yash-pouranik, I’m a GSSoC’26 contributor. Just checking on the current status of this issue since there hasn’t been an update for a few days.

The planned approach looks solid overall, especially adding zxcvbn support on both frontend and backend with reusable validation components.

If the issue becomes inactive or unassigned at any point, I’d be interested in working on it and implementing the full flow including:

  • reusable password strength utilities
  • frontend live validation
  • backend enforcement
  • improved UX/error handling
  • tests for weak/strong password cases

Would be happy to take it up if needed.

udaycodespace avatar May 25 '26 10:05 udaycodespace

@NAYAMATVISION Hoping u are working?

yash-pouranik avatar May 25 '26 10:05 yash-pouranik

@yash-pouranik Since @NAYAMATVISION originally picked this up and already explored the implementation direction, I think it makes sense to give her some more time and priority first.

That said, I’ve also been going through the auth flow and already have a fairly good idea of how the frontend/backend integration for this would fit together. So if there’s no response/update after some time and the issue becomes inactive, I’d be happy to continue working on it from there and implement the full flow.

Otherwise, if you have any other backend/auth/security-related issues that are less crowded or currently unassigned, feel free to tag or assign me. I’d love to work on those as well as a GSSoC’26 contributor.

udaycodespace avatar May 25 '26 10:05 udaycodespace

@yash-pouranik Just following up since there hasn’t been any update from @NAYAMATVISION for several hours after the implementation discussion.

If the issue is currently inactive or needs additional help, I’d be happy to work on it and implement the full frontend + backend password-strength flow with zxcvbn, validation utilities, UI feedback, and tests.

Estimated implementation time from my side would likely be around half a day for a clean end-to-end implementation.

udaycodespace avatar May 25 '26 17:05 udaycodespace

I always wait for atleast 1 day, before revoking someone assignmnt I think this is a good practice?? @udaycodespace

yash-pouranik avatar May 25 '26 17:05 yash-pouranik

Just saw she already raised the PR

yash-pouranik avatar May 25 '26 17:05 yash-pouranik

@yash-pouranik Fair enough, I agree 👍

If you have any other less crowded or unassigned backend/auth/security issues meanwhile, feel free to tag me there as well.

5vd5 avatar May 25 '26 17:05 5vd5

sure just a min

yash-pouranik avatar May 25 '26 17:05 yash-pouranik

2 diff accounts?? @uday-works @udaycodespace

yash-pouranik avatar May 25 '26 17:05 yash-pouranik

@yash-pouranik Yeah both are mine. I mistakenly commented from my alt account earlier, sorry for the confusion 😅

udaycodespace avatar May 25 '26 17:05 udaycodespace