Usage of weak hashing library (SHA-1)
- Rule ID: go_lang_weak_hash_sha1
- Languages: go
- Source: weak_hash_sha1.yml
Description
Using a weak hashing library such as SHA-1 can compromise data security. SHA-1 is no longer considered secure due to vulnerabilities that can lead to data breaches.
Remediations
- Do not use SHA-1 for hashing. It is considered weak and vulnerable to attacks.
sha1.Sum([]byte("password")) // unsafe
- Do use stronger hashing algorithms such as SHA-256 to enhance security.
sha256.Sum256([]byte("string"))
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=go_lang_weak_hash_sha1
To run only this rule during a scan, use the following flag
bearer scan /path/to/your-project/ --only-rule=go_lang_weak_hash_sha1