Skip to content

Fix/client side password hashing#31

Draft
NeonCharlie-24 wants to merge 3 commits into
NeonGeckoCom:devfrom
NeonCharlie-24:fix/client-side-password-hashing
Draft

Fix/client side password hashing#31
NeonCharlie-24 wants to merge 3 commits into
NeonGeckoCom:devfrom
NeonCharlie-24:fix/client-side-password-hashing

Conversation

@NeonCharlie-24
Copy link
Copy Markdown
Collaborator

@NeonCharlie-24 NeonCharlie-24 commented Mar 25, 2026

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 password to password_hash to 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/signup and /auth/login request payloads contain SHA-256 hex strings instead of a plaintext strings. Confirmed signup and login both succeed end-to-end.

  • Before:

Sign-up payload to back-end before hashing Login payload to back-end before hashing
  • After:
Sign-up payload to back-end after hashing Login payload to back-end after hashing

Made with Cursor.

@NeonDaniel
Copy link
Copy Markdown
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 password as a fallback auth flow (i.e. Client sends hash, gets auth error, sends plaintext, server updates database using new hash method).

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.

@NeonDaniel NeonDaniel marked this pull request as draft March 30, 2026 19:43
@NeonDaniel NeonDaniel changed the base branch from main to dev May 19, 2026 00:48
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.

[BUG] Passwords are passed in plaintext to the backend server

2 participants