Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/mighty-sloths-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@genseki/plugins": patch
---

Fix [Phone Plugin] Avoid User Enumeration by changing login error message
6 changes: 3 additions & 3 deletions packages/plugins/src/phone/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ export class PhoneService<
const user = await this.store.getUserByPhone(body.phone)

if (!user) {
return err({ message: 'User not found' })
return err({ message: 'Invalid password or user not found' })
}

const accounts = await this.store.getAccountByUserId(user.id)
const credentialAccount = accounts.find((a) => a.provider === AccountProvider.CREDENTIAL)

if (!credentialAccount || !credentialAccount.password) {
return err({ message: 'Account not found or password not set' })
return err({ message: 'Invalid password or user not found' })
}

// NOTE: verifyPassword function is default from options, can be customized
Expand All @@ -143,7 +143,7 @@ export class PhoneService<
}

if (!verifyStatus.value) {
return err({ message: 'Invalid password' })
return err({ message: 'Invalid password or user not found' })
}

const session = await this.createSession(user.id)
Expand Down
Loading