Weak encryption algorithm (SHA1) used for password detected.

Description

A weak hashing library can lead to data breaches and greater security risk.

Remediations

According to OWASP, sha1 and its predecessors are considered weak hash algorithms and therefore shouldn't be used.

❌ Do not use encryption for passwords, wherever possible:

hashlib.sha1(user.password).digest()

✅ Instead, we recommend using sha256:

hashlib.sha256(user.password).digest()

Associated CWE

OWASP Top 10

Configuration

To skip this rule during a scan, use the following flag

bearer scan /path/to/your-project/ --skip-rule=python_lang_weak_password_encryption_sha1

To run only this rule during a scan, use the following flag

bearer scan /path/to/your-project/ --only-rule=python_lang_weak_password_encryption_sha1

Ready to take the next step? Learn more about Bearer Cloud.