Usage of weak hashing library (Adler-32)

Description

Adler-32 is a weak hashing algorithm that offers minimal security. It is not suitable for protecting data against intentional modifications.

Remediations

  • Do not use Adler-32 for hashing when security is a concern. Its simplicity and speed do not compensate for its lack of protection against data tampering.
    myhash = zlib.adler32(data) # unsafe
  • Do opt for stronger hashing algorithms like SHA-256 to ensure data integrity and security.
    myhash = hashlib.sha256(data).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_hash_adler32

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

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