#0704
A developer configured bcrypt with a cost factor (rounds) of 4 to speed up tests. That setting was never changed for production.
bcrypt with 4 rounds completes in under 1 millisecond. An attacker with a leaked database can run billions of guesses per second.
OWASP recommends a minimum bcrypt cost factor of 10; NIST recommends tuning until hashing takes at least 300 ms on your hardware — commonly rounds 12+.
The cost factor is bcrypt's defence against brute-force. Developers often lower it during development for speed, then forget to raise it. A cost factor of 4 provides essentially no protection on modern hardware.
validateHashConfig to throw 'Insufficient rounds' when config.rounds is less than 12.'Unsupported algorithm' if config.algorithm is not one of bcrypt, argon2, or scrypt.validateHashConfig({ algorithm: 'bcrypt', rounds: 4 })// → throws Error('Insufficient rounds')
validateHashConfig({ algorithm: 'bcrypt', rounds: 12 })// → { algorithm: 'bcrypt', rounds: 12 }
'Insufficient rounds' for low round counts.'Unsupported algorithm' for unknown algorithms.