mirror of
https://github.com/simple-login/app.git
synced 2024-09-30 05:31:30 +02: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
@ -2971,11 +2971,7 @@ class RecoveryCode(Base, ModelMixin):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def find_by_user_code(cls, user: User, code: str):
|
def find_by_user_code(cls, user: User, code: str):
|
||||||
hashed_code = cls._hash_code(code)
|
hashed_code = cls._hash_code(code)
|
||||||
# TODO: Only return hashed codes once there aren't unhashed codes in the db.
|
return cls.get_by(user_id=user.id, code=hashed_code)
|
||||||
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)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def empty(cls, user):
|
def empty(cls, user):
|
||||||
|
Loading…
Reference in New Issue
Block a user