mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Use hmac.compare_digest to compare hashes
Co-Authored-By: Timost <Timost@users.noreply.github.com>
This commit is contained in:
parent
e77e27730b
commit
f1087662a0
1 changed files with 1 additions and 1 deletions
|
@ -184,7 +184,7 @@ class BaseAuthenticator(object):
|
|||
to_hash = "{id}:{token}".format(id=session_id, token=session_token)
|
||||
hash_ = hashlib.sha256(to_hash).hexdigest()
|
||||
|
||||
if hash_ != stored_hash:
|
||||
if not hmac.compare_digest(hash_, stored_hash):
|
||||
raise MoulinetteError('invalid_token')
|
||||
else:
|
||||
return
|
||||
|
|
Loading…
Add table
Reference in a new issue