-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix!: api login should not suggest which credential is wrong (#32159)
- Loading branch information
Showing
6 changed files
with
33 additions
and
26 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@rocket.chat/meteor": major | ||
--- | ||
|
||
Api login should not suggest which credential is wrong (password/username) | ||
|
||
Failed login attemps will always return `Unauthorized` instead of the internal fail reason |
14 changes: 0 additions & 14 deletions
14
apps/meteor/app/lib/server/lib/loginErrorMessageOverride.js
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
apps/meteor/app/lib/server/lib/loginErrorMessageOverride.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Do not disclose if user exists when password is invalid | ||
import { Accounts } from 'meteor/accounts-base'; | ||
import { Meteor } from 'meteor/meteor'; | ||
|
||
const { _runLoginHandlers } = Accounts; | ||
|
||
Accounts._options.ambiguousErrorMessages = true; | ||
Accounts._runLoginHandlers = async function (methodInvocation, options) { | ||
const result = await _runLoginHandlers.call(Accounts, methodInvocation, options); | ||
|
||
if (result.error instanceof Meteor.Error) { | ||
result.error = new Meteor.Error(401, 'User not found'); | ||
} | ||
|
||
return result; | ||
}; |
This file contains 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
This file contains 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
This file contains 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