Fix/client side password hashing#31
Draft
NeonCharlie-24 wants to merge 3 commits into
Draft
Conversation
Member
|
Hmm.. Looking at this being a breaking change and thinking about potential solutions to backwards-compat. I think one option would be to fall back to parsing plaintext Another option would be not change password handling here and instead move to implement and prefer oauth to replace native authentication. I'll put some more thought into this, but open to ideas/suggestions. |
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.
Description
Moves password hashing to the frontend so the backend never receives plaintext passwords. The frontend now SHA-256 hashes passwords using the Web Crypto API before sending them to the backend, where they are then bcrypt-hashed for storage. API field renamed from
passwordtopassword_hashto make the contract explicit.Issues
Closes #27
Other Notes
Breaking change: This is not backwards-compatible. All existing users will need to re-register, as their stored bcrypt hashes were derived from plaintext passwords rather than the newly generated SHA-256 hashes.
Manually verified via browser DevTools that
/auth/signupand/auth/loginrequest payloads contain SHA-256 hex strings instead of a plaintext strings. Confirmed signup and login both succeed end-to-end.Before:
Made with Cursor.