Skip to content

Commit

Permalink
Patched /tmp/tmpykmnswgg/sqli/dao/user.py
Browse files Browse the repository at this point in the history
  • Loading branch information
patched.codes[bot] committed Sep 6, 2024
1 parent aca15a9 commit 3d0c6da
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sqli/dao/user.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from hashlib import md5
from cryptography.hazmat.primitives import hashes
from typing import NamedTuple, Optional

from aiopg import Connection
Expand Down Expand Up @@ -38,4 +38,6 @@ async def get_by_username(conn: Connection, username: str):
return User.from_raw(await cur.fetchone())

def check_password(self, password: str):
return self.pwd_hash == md5(password.encode('utf-8')).hexdigest()
digest = hashes.Hash(hashes.SHA384())
digest.update(password.encode('utf-8'))

Check failure

Code scanning / CodeQL

Use of a broken or weak cryptographic hashing algorithm on sensitive data High

Sensitive data (password)
is used in a hashing algorithm (SHA384) that is insecure for password hashing, since it is not a computationally expensive hash function.
return self.pwd_hash == digest.finalize().hex()

0 comments on commit 3d0c6da

Please sign in to comment.