mirror of
https://github.com/simple-login/app.git
synced 2024-11-13 07:31:12 +01:00
[Security] Remediate 2FA bypass with hashed recovery code (#2132)
* Fix Vuln (allow 2FA bypass with hashed recovery code) Remove comparison of hashed recovery code from db with the user input. * Formatting * Remove Comment
This commit is contained in:
parent
1ecc5eb89b
commit
4817dfdcaf
1 changed files with 1 additions and 5 deletions
|
@ -2971,11 +2971,7 @@ class RecoveryCode(Base, ModelMixin):
|
|||
@classmethod
|
||||
def find_by_user_code(cls, user: User, code: str):
|
||||
hashed_code = cls._hash_code(code)
|
||||
# TODO: Only return hashed codes once there aren't unhashed codes in the db.
|
||||
found_code = cls.get_by(user_id=user.id, code=hashed_code)
|
||||
if found_code:
|
||||
return found_code
|
||||
return cls.get_by(user_id=user.id, code=code)
|
||||
return cls.get_by(user_id=user.id, code=hashed_code)
|
||||
|
||||
@classmethod
|
||||
def empty(cls, user):
|
||||
|
|
Loading…
Reference in a new issue