Skip to content

[Security] Replace insecure password hashing with bcrypt and add input validation #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Kinshuk2903
Copy link

Description

This PR addresses critical security vulnerabilities and improves data integrity in the student management system by:

Security Enhancements 🔒

  • Replaced vulnerable character-shifting password hashing with industry-standard bcrypt via passlib
  • Added secure password verification function
  • Implemented proper password storage best practices

Validation Improvements ✅

  • Added robust email format validation using regex
  • Enforced minimum password length (8 characters)
  • Prevented duplicate email registration
  • Added null checks for optional update fields

Code Quality Improvements ✨

  • Added comprehensive type hints
  • Split logic into reusable helper functions
  • Fixed PEP8 naming conventions
  • Improved error messaging for API consumers

Testing Performed

  • Verified password hashing/verification flow
  • Tested all CRUD operations with edge cases
  • Confirmed proper validation error messages
  • Verified backward compatibility

Migration Notes

⚠️ Existing passwords will need to be rehashed. A migration script should be run to update all stored passwords to bcrypt format.

Resolves: #123 (link to related issue if applicable)

@pratik-mahalle
Copy link

Hey @Kinshuk2903, Thank you for raising the pr. Our team will review the changes before that please make sure to sign the DCO sign off before commiting the changes

@pratik-mahalle
Copy link

Hi @Kinshuk2903, I am not able to see any of the code in this pr, Please clarify what you were trying to do here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants