MEDIUM AI PREVALENCE: MEDIUM auth.rust.crypto.bcrypt-low-cost
bcrypt::hash (or bcrypt::hash_with_result) is called with a cost factor below 10.
Why AI tools produce this: AI coding tools produce this regularly, typically when prompted for a shortcut or a quick fix.
Why this matters
A low work factor makes each hash cheap to compute, which lets an attacker brute-force stolen password hashes far too quickly. OWASP recommends a bcrypt cost of at least 10, and ≥ 12 for new applications, tuned so a single hash takes roughly 250ms on your hardware.
Common LLM-generated mistake: bcrypt::hash(password, 8) because the literal "looks fast enough". Use bcrypt::DEFAULT_COST (12) or raise the cost factor to 12 or higher.
VULNERABLE
SAFE
Suppressing this rule
If a finding is a genuine false positive, scope the suppression to the exact line and leave a reason, never disable the rule project-wide. Disable directives are line-scoped by design.
// oauthlint-disable-next-line auth.rust.crypto.bcrypt-low-cost -- <reason>