Usage of weak hashing library on a password (SHA-1)

Description

Using weak hashing algorithms like SHA-1 for password storage compromises security. These algorithms are vulnerable to attacks, making it easier for attackers to crack passwords and access sensitive information.

Remediations

  • Do not use SHA-1 for hashing passwords. These algorithms are no longer considered secure due to their vulnerability to various attacks.
  • Do use a recommended hashing library such as Argon2id for hashing passwords. This approach enhances security by providing a more robust defense against brute-force attacks.
    const argon2 = require("argon2");
    const hash = await argon2.hash(req.params.password, { type: argon2.argon2id })

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

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

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