Usage of weak hashing library (SHA1)

  • Rule ID: javascript_lang_weak_hash_sha1
  • Languages: javascript
  • Source: weak_hash_sha1.yml

Description

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

Remediations

According to OWASP, SHA1 is considered a weak hash algorithm and therefore shouldn't be used.

✅ Use stronger hashing algorithms when storing data.

const crypto = require("crypto");

const key = "secret key";
const hash = crypto.createHmac("es-256-cbc", key).update(user.password);

Resources

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_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_hash_sha1

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