[GH-ISSUE #1879] Unncecessary hashing of password in username plugin #8957

Closed
opened 2026-04-13 04:12:20 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @VIEWVIEWVIEW on GitHub (Mar 19, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/1879

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

I'm currently forking the username plugin for my own needs, and I stumbled accross a call on hash in the signInUsername method when the user is not found. I believe L146 is unnecessary here, as we will throw an error anyway and the context won't do anything with the hashed pw.

90f15abc95/packages/better-auth/src/plugins/username/index.ts (L145-L151)

Current vs. Expected behavior

What version of Better Auth are you using?

latest

Provide environment information

-

Which area(s) are affected? (Select all that apply)

Backend

Auth config (if applicable)


Additional context

No response

Originally created by @VIEWVIEWVIEW on GitHub (Mar 19, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/1879 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce I'm currently forking the username plugin for my own needs, and I stumbled accross a call on ``hash`` in the ``signInUsername`` method when the user is not found. I believe **L146** is unnecessary here, as we will throw an error anyway and the context won't do anything with the hashed pw. https://github.com/better-auth/better-auth/blob/90f15abc957a789876f2bd68aa64eb6df037ab6e/packages/better-auth/src/plugins/username/index.ts#L145-L151 ### Current vs. Expected behavior - ### What version of Better Auth are you using? latest ### Provide environment information ```bash - ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript ``` ### Additional context _No response_
GiteaMirror added the lockedbug labels 2026-04-13 04:12:20 -05:00
Author
Owner

@SiNONiMiTY commented on GitHub (Apr 17, 2025):

this is also present on the signInEmail method

8931a1f969/packages/better-auth/src/api/routes/sign-in.ts (L459)

<!-- gh-comment-id:2813880241 --> @SiNONiMiTY commented on GitHub (Apr 17, 2025): this is also present on the signInEmail method https://github.com/better-auth/better-auth/blob/8931a1f969a44d0f015a2509c5a5765ddfd6b34e/packages/better-auth/src/api/routes/sign-in.ts#L459
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8957