Usage of weak hashing library (SHA)

Description

Using a weak hashing library, such as SHA or SHA-1, compromises data security. These algorithms are no longer considered secure due to vulnerabilities that can lead to data breaches.

Remediations

  • Do not use SHA or SHA-1 for hashing. These algorithms are outdated and vulnerable to attacks.
    Digest::SHA.hexdigest('weak hash')
    Digest::SHA1.hexdigest('weak hash')
  • Do use stronger hashing algorithms like bcrypt for enhanced security.
    BCrypt::Password.create('iLOVEdogs123')

References

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=ruby_lang_weak_hash_sha

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

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